Mail Archives: djgpp/1997/06/07/11:03:18
Peter Palotas wrote:
> Is there some way I can call the parent::foo() from within child::foo()?
> Or
> is this just impossible?
Sure. The syntax is exactly what you used. You can use the scope
resolution operator (::) to call base member functions:
class parent
{
public:
virtual int foo(void);
};
class child: public parent
{
public:
int foo(void);
};
int child::foo(void)
{
parent::foo();
// ...
}
Note that if this were all you wanted to do (i.e., call the parent member
functions and nothing more), then you wouldn't need to declare the virtual
function in the derived class in the first place, since it would already
have that behavior.
--
Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com
Alcyone Systems / web / http://www.alcyone.com/max/
San Jose, California, United States / icbm / 37 20 07 N 121 53 38 W
\
"Covenants without the sword / are but words."
/ Camden
- Raw text -