Explain Base Class Pointer with an example

Questions by Sweet Titly

Showing Answers 1 - 1 of 1 Answers


  • Feb 22nd, 2012

Base class pointer with example

  1. class A{};

  2. class B:public{};

  3. int main(){

  4. A* ptrA; //base class pointer

  5. //ptrA=new B();

  6. //or

  7. //ptrA =new A();

  8. return 0;

  9. }

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions