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.
1
Expert's answer
2014-09-05T07:38:59-0400
#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 the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS