home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!gatech!usenet.ins.cwru.edu!agate!stanford.edu!kronos.arc.nasa.gov!butch!netcomsv!netcom.com!csus.edu!borland.com!pete
- From: pete@borland.com (Pete Becker)
- Subject: Re: Calling of a parent method
- Message-ID: <1993Jan21.224001.18123@borland.com>
- Originator: pete@genghis.borland.com
- Sender: news@borland.com (News Admin)
- Organization: Borland International
- References: <1993Jan20.153647.25160@neptune.inf.ethz.ch>
- Date: Thu, 21 Jan 1993 22:40:01 GMT
- Lines: 22
-
- In article <1993Jan20.153647.25160@neptune.inf.ethz.ch> mhof@iiic.ethz.ch (Markus Alexander Hof) writes:
- >
- >My question now: Is therea way to specify a call to a method of your immediate parent,
- >without naming him, so that is is possible to insert an intermeddiate class without
- >having to cchange the son
-
- Sure is. Not quite as convenient as having a keyword:
-
- class D : public B
- {
- typedef B Parent;
- void f();
- };
-
- void D::f()
- {
- Parent::f();
- }
-
- If you change the name of the base class you have to change the
- typedef, but nothing else has to be changed.
- -- Pete
-