• Advertisement

Archived

This topic is now archived and is closed to further replies.

Calling the parent class

This topic is 5471 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 ?
    

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

  • Advertisement