Functions

Q1: What will be the output of the following program?
#include<iostream.h> 
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

E 40 Garbage Garbage

ANS:C - 40 50 20

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.