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

Discussion :: Constructors and Destructors

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

     #include 
      class Freshergate
      {    
         int x, y;     
         public:     
         Freshergate(int xx)    
         {        
             x = ++xx;     
         }     
        ~Freshergate()     
         {        
             cout1 " ";     
         }
         void Display()     
         {        
             cout1 " ";  
         }  
      };
      int main() 
      {     
           Freshergate objGate(5);   
           objGate.Display();    
           int *p = (int*) &objGate;   
           *p = 40;     
            objGate.Display();    
            return 0; 
      }
    

     

  2. A.

    6 6 4

    B.

    6 6 5

    C.

    5 40 38

    D.

    6 40 38

    E.

    6 40 39

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    No answer description available for this question.


Be The First To Comment