Home / C++ Programming / Objects and Classes :: Discussion

Discussion :: Objects and Classes

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

    #include 
     class GateBase
     {  
        public:       
           float x; 
     };  
     class GateDerived : public GateBase 
     {    
        public:        
          char ch;        
           void Process()         
           {      
               ch = (int)((x=12.0)/3.0);           
          }       
          void Display()    
         {         
             coutint)ch;    
         }  
      };  
      int main() 
      {    
       class GateDerived  *objDev = new GateDerived;    
      objDev->Process();    
      objDev->Display();    
      return 0;  
    }
    

  2. A.

    The program will print the output 4.

    B.

    The program will print the ASCII value of 4.

    C.

    The program will print the output 0.

    D.

    The program will print the output garbage.

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    No answer description available for this question.


Be The First To Comment