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

Discussion :: Constructors and Destructors

  1. Which of the following statement is correct about the program given below?

      #include 
      class FresherGate
      {   
            int x, y;     
            public:     
              FresherGate()      
              {            
                 x = 0;         
                 y = 0;        
              }         
              FresherGate(int xx, int yy)     
              {           
                  x = xx;       
                  y = yy;         
             }
             FresherGate(FresherGate *objB)  
             {        
                 x = objB->x;        
                 y = objB->y;     
            }     
            void Display()   
            {        
              cout" "  int main() 
      {  
         FresherGate  objGate( new FresherGate(20, 40) );     
         objGate.Display(); 
         return 0; 
      }
    

  2. A.

    The program will print the output 0 0 .

    B.

    The program will print the output 20 40 .

    C.

    The program will print the output Garbage Garbage .

    D.

    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