-
What is the output of this program?
#include <iostream>
using namespace std;
class Employee
{
public:
int IdNo , Salary , bonus ;
protected:
void get()
{
IdNo = 101, Salary = 15000, bonus = 5000;
}
};
class Extra
{
public:
int Gift;
void getGift()
{
Gift = 4000;
}
};
class statement : public Employee, public Extra
{
int GrandTotal, Average;
public:
void display()
{
GrandTotal = (Salary + bonus);
Average = GrandTotal / 2;
cout << GrandTotal << " ";
cout << Average;
}
void setObject()
{
get();
}
};
int main()
{
statement object;
object.setObject();
object.getGift();
object.display();
}
-
- 15000 5000
- 5000 15000
- 4000 15000
- 10000 20000
- 20000 10000
Correct Option: E
20000 10000