Question: What will be the output of the following program?
#include
class BaseCounter
{
protected:
long int count;
public:
void CountIt(int x, int y = 10, int z = 20)
{
count = 0;
cout<< x << " " << y << " " << z << endl;
}
BaseCounter()
{
count = 0;
}
BaseCounter(int x)
{
count = x ;
}
};
class DerivedCounter: public BaseCounter
{
public:
DerivedCounter()
{ }
DerivedCounter(int x): BaseCounter(x)
{ }
};
int main()
{
DerivedCounter objDC(30);
objDC.CountIt(40, 50);
return 0;
}
[A].30 10 20
[B].Garbage 10 20
[C].40 50 20
[D].20 40 50
Answer: Option C