Home » C++ Programming » Classes & Objects » Question
  1. What is the output of this program?
    #include <iostream>
    using namespace std;
    class First
    {
    public:
    First(int num1 )
    {
    cout << num1 <<" ";
    }
    };
    class Second: public First
    {
    public:
    Second(int num1, double num2)
    : First(num1)
    {
    cout << num2 <<" ";
    }
    };
    class Third: public Second
    {
    public:
    Third(int num1, double num2, char ch)
    : Second(num1, num2)
    {
    cout < }
    };
    int main()
    {
    Third object(6, 5.35, 'I');
    return 0;
    }
    1. 6 I 5.35
    2. 6 3.5
    3. I 5.3 6
    4. I 6
    5. 6 5.35 I
Correct Option: E

In this program, We are passing the value and manipulating by using the derived class.



Your comments will be displayed only after manual approval.