Re: Retrofitting base class with pure virtual function
From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 04/10/04
- Next message: Joseph M. Newcomer: "Re: SP6 Problem"
- Previous message: Joseph M. Newcomer: "Re: How to catch the event that a CEdit control is being "programatically" changed for its content?"
- In reply to: Ken->: "Retrofitting base class with pure virtual function"
- Next in thread: Ken->: "Re: Retrofitting base class with pure virtual function"
- Reply: Ken->: "Re: Retrofitting base class with pure virtual function"
- Reply: Ken->: "Re: Retrofitting base class with pure virtual function"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 10 Apr 2004 13:58:14 -0400
You can't. If you introduce a pure virtual method, every derived class must implement the
virtual method. If they do not, then you can't implement a pure virtual method (you might
consider implementing a method that does ASSERT(FALSE), but if you add a new pure virtual
method, every derived class will have to be modified to implement a real version of the
method). That's just how C++ works.
joe
On Wed, 7 Apr 2004 17:56:55 -0400, "Ken->" <handsom@comcast.netspicedham> wrote:
>I have a base class that is inherited by several classes and they all have
>there own ReadFile and WriteFile functions. The base class does not have a
>ReadFile or WriteFile, but can I now add a pure virtual ReadFile and
>WriteFile function to the base class without screwing up the classes that
>already inherit from it?
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
- Next message: Joseph M. Newcomer: "Re: SP6 Problem"
- Previous message: Joseph M. Newcomer: "Re: How to catch the event that a CEdit control is being "programatically" changed for its content?"
- In reply to: Ken->: "Retrofitting base class with pure virtual function"
- Next in thread: Ken->: "Re: Retrofitting base class with pure virtual function"
- Reply: Ken->: "Re: Retrofitting base class with pure virtual function"
- Reply: Ken->: "Re: Retrofitting base class with pure virtual function"
- Messages sorted by: [ date ] [ thread ]