Virtual function question
From: BCC (bryan_at_akanta.com)
Date: 06/30/04
- Next message: JKop: "Re: Virtual function question"
- Previous message: JLK: "Re: Passing Variables To System()"
- Next in thread: JKop: "Re: Virtual function question"
- Reply: JKop: "Re: Virtual function question"
- Reply: Xenos: "Re: Virtual function question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 30 Jun 2004 17:34:08 GMT
Hi,
If I have a base class with a virtual function defined:
class CBase {
virtual void Foo();
};
void CBase::Foo()
{
// base class functionality
}
and a derived class which overrides the base class Foo():
class CDerived: public CBase {
void Foo();
};
CDerived::Foo()
{
// derived functionality
}
If I had a pointer to an object of type CDerived, how can I call the base
classes version of Foo() rather than the polymorphic version?
CDerived derived;
CDerived* p_derived = &derived;
p_derived->Foo(); // Want to somehow be able to call base class Foo()!
I think there is a simple way to do this, but I can't find it.
Thanks,
B
- Next message: JKop: "Re: Virtual function question"
- Previous message: JLK: "Re: Passing Variables To System()"
- Next in thread: JKop: "Re: Virtual function question"
- Reply: JKop: "Re: Virtual function question"
- Reply: Xenos: "Re: Virtual function question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|