Home / C++ Programming / Constructors and Destructors :: Discussion

Discussion :: Constructors and Destructors

  1. What will be the output of the following program?

     #include
      class GateBase
      {
         public:  
         int x, y;    
         GateBase(int xx = 0, int yy = 5)    
         {         
             x = ++xx;     
             y = --yy;   
         }
         void Display()     
         {       
              cout class GateDerived : public GateBase
          {    
          public:  
          void Increment()   
          {       
               y++;    
          }     
          void Display()    
          {         
              cout
       }:  }
       int main() 
       {    
             GateDerived objGate;     
             objGate.Increment();     
             objGate.Display();  
             return 0;  
       }
    

  2. A.

    3

    B.

    4

    C.

    5

    D.

    Garbage-value

    E.

    The program will report compile time error.

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    No answer description available for this question.


Be The First To Comment