Mail Archives: djgpp/1997/06/04/10:13:05
> If I have the following two classes:
> class parent
> {
> public:
> virtual int foo(void)
> {
> cprintf("Parent foo");
> }
> };
> class child : public parent
> {
> public:
> int foo(void)
> {
> cprintf("Child foo");
> }
> };
> Is there some way I can call the parent::foo() from within child::foo()?
Or
> is this just impossible?
It is possible.
class new_born_child
{
public:
int foo()
{
return cprintf("new_born_child foo");
}
int ExampleOfParentFoo()
{
return parent::foo();
}
};
by the way, the code you gave will not compile ("missing return value"
error)
Eyal.
- Raw text -