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 GATE
       {    
            int x;    
      public:     
            GATE();     
            void Show() const;       
           ~GATE(){}
     }; 
     GATE::GATE()
     {   
         x = 5; 
     }
     void GATE::Show() const 
     { 
         coutint main()
     {     
         GATE objB;  
         objB.Show();   
         return 0;  
     }
    

  2. A.

    The program will print the output 5.

    B.

    The program will print the output Garbage-value.

    C.

    The program will report compile time error.

    D.

    The program will report runtime error.

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    No answer description available for this question.


Be The First To Comment