delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/04/08:43:09

Date: Wed, 4 Jun 1997 07:42:36 -0500 (CDT)
From: Andrew Deren <aderen AT eecs DOT uic DOT edu>
To: Peter Palotas <blizzar AT hem1 DOT passagen DOT se>
cc: djgpp AT delorie DOT com
Subject: Re: Virtual functions
In-Reply-To: <3.0.16.19970605110638.2d5f362a@hem1.passagen.se>
Message-ID: <Pine.SUN.3.95.970604074126.12606A-100000@ernie.eecs.uic.edu>
MIME-Version: 1.0

On Wed, 4 Jun 1997, Peter Palotas wrote:

> 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?

That is exacly what you did in the message above, just use:
parent::foot();
and the parent foo functions will be called.

> 
> 
> // Blizzar -- blizzar AT hem1 DOT passagen DOT se -- http://hem1.passagen.se/dnt
> 
> ****************************************************************************
> Don't tell me about the answer, 'cause then another one will come along soon
> I don't believe you have the answer, I've got ideas too
> But if you got enough naivity, and you got conviction
> then the answer is perfect for you!
> 
> // Bad Religion - Generator, The Answer
> ****************************************************************************
> 
> 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019