C++ MQCs with Explanation (CHAPTER : POINTERS, VIRTUAL FUNCTIONS AND POLYMORPHISM

consider the following class definition: class Test { public : void show (void) {cout <<”Test”;} }; If x is an object of Test and ptr is a pointer to x, then which one of the following statements can correctly invoke the function show ( )?

  1. x.show ( ) ;
  2. ptr -> show ( ) ;y
  3. (*ptr). show ( );
  4. all the three



Answer: 
Option d: all the three

Explanation Here

Post a Comment

0 Comments