Calling the parent class

Started by
0 comments, last by logout 21 years, 1 month ago
How can i call a method in the parent class witch i have overloaded in the child class ?

class CParent
{
   public:
       virtual void Print() { cout << 1 << endl; }
};

class CChild : public CParent
{
  public:
      virtual void Print()
             { 
                 cout << 2 << endl: 
                 // here i want to call the parent so i get the output : "21"
             }
};

How can this be done ?
    
Advertisement
call
  CParent::Print()   
from within
  CChild::Print()   


However, you won't get "21" because you have endl in both functions.

[edited by - fizban75 on March 5, 2003 12:54:52 PM]

[edited by - fizban75 on March 5, 2003 12:55:21 PM]

This topic is closed to new replies.

Advertisement