Home » C++ Programming » Modifier Types » Question
  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();
    }
    1. 15000 5000
    2. 5000 15000
    3. 4000 15000
    4. 10000 20000
    5. 20000 10000
Correct Option: E

20000 10000



Your comments will be displayed only after manual approval.