1.

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();
}

A. 15000 5000
B. 5000 15000
C. 4000 15000
D. 10000 20000
E. 20000 10000
Answer» F.


Discussion

No Comment Found

Related MCQs