-
What is the output of this program?
#include <iostream>
using namespace std;
class Base
{
protected:
int K;
public:
Base(int num1)
{
K = num1;
}
~Base()
{
}
};
class Derived: public Base
{
int L;
public:
Derived(int num1, int num2): Base(num2)
{
L = num1;
}
~Derived()
{
}
void show()
{
cout << K << " " << L << endl;
}
};
int main()
{
Derived object(5, 6);
object.show();
return 0;
}
-
- 5
- 6
- 5 6
- 6 5
- None of these
Correct Option: D
In this program, We are passing the values and assigning it to K and L and we are printing it.