-
What is the output of this program?
#include
using namespace std;
class StudentClass
{
public:
int RollNo , mark1 , mark2 ;
void get()
{
RollNo = 25, mark1 = 15, mark2 = 40;
}
};
class sportsClass
{
public:
int sortMarks;
void getsm()
{
sortMarks = 20;
}
};
class statementClass:public StudentClass,public sportsClass
{
int Total,average;
public:
void display()
{
Total = (mark1 + mark2 + sortMarks);
average = Total / 3;
cout << Total << " ";
cout << average;
}
};
int main()
{
statementClass object;
object.get();
object.getsm();
object.display();
}
-
- 25 15
- 40 15
- 75 25
- 25 75
- None of these
Correct Option: C
In this program, We are calculating the total and average marks of a student by using multiple inheritance.