60 465
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #45674 in C++ for Anjana Ramanan

Question #45674
write a program to create a base class students with data member, name and rollno to class test and store derived from students details contain test mark and sports contain sports mark.
Expert's answer
#include <iostream>
class Student{
private:
  std::string name;
  int rollNo;
public:
  Student(const std::string name, int number) {
this->name = name;
this->rollNo = number;
  }
  std::string getName() {
return name;
  }
  int getRollNo() {
return rollNo;
  }
};
class Test : public Student {};

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions