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

Discussion :: Constructors and Destructors

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

     #include
      class Freshergate
      {    
          public:  
          GATEBase()    
          {      
             cout"Base OK. ";    
          } 
      };
      class GATEDerived: public GATEBase 
      { 
          public: 
          GATEDerived()    
         {         
            cout"Derived OK. ";   
         }   
         ~BixDerived()     
         {      
              cout"Derived DEL. ";
          }
     };
     int main()
     {    
         GATEBase    objB;  
         GATEDerived objD;      
         objD.~GATEDerived(); 
         return 0; 
    }
    

     

  2. A.

    Base OK. Derived OK. Derived DEL.

    B.

    Base OK. Base OK. Derived OK. Derived DEL.

    C.

    Base OK. Derived OK. Derived DEL. Derived DEL.

    D.

    Base OK. Base OK. Derived OK. Derived DEL. Derived DEL.

    E.

    The program will report compile time error.

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    No answer description available for this question.


Be The First To Comment