"markww" <ma****@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
: Hi,
:
: I have this class:
:
: class CBase {
: int m_nData;
: OnStart();
: OnRightMouseClick();
You forgot to specify the mandatory return types.
Also if you want to override the functions in a subclass,
you need to declare them as virtual in CBase.
So:
virtual void OnStart();
virtual void OnRightMouseClick();
: }
:
: I want to derive another class from it and keep all its functions the
: same, but I want to override OnRightMouseClick() with its own code:
:
: class CNew : public CBase {
:
: OnRightMouseClick(); // CNew specific code in here.
Instead: virtual void .... [ virtual is optional here ]
: }
:
: Is that possible, how do I do it?
Given the above:
void CNew::OnRightMouseClick()
{
//....
CBase::OnRightMouseClick(); // if you wish to call the base class
}
: Thanks as always
hth -Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <
http://www.brainbench.com