Home / C++ Programming / Functions - C++ :: Discussion

Discussion :: Functions - C++

  1. 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" " " " 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; 
      }
    

  2. A.

    30 10 20

    B.

    Garbage 10 20

    C.

    40 50 20

    D.

    20 40 50

    E.

    40 Garbage Garbage

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    No answer description available for this question.


Be The First To Comment