home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!spool.mu.edu!agate!ames!sun-barr!news2me.EBay.Sun.COM!seven-up.East.Sun.COM!sungy!news.Sweden.Sun.COM!swippy!seunet!sunic!mcsun!sun4nl!utrcu1!infnews!infnews!stadt
- From: stadt@cs.utwente.nl (Richard van de Stadt)
- Newsgroups: comp.lang.c++
- Subject: Re: Calling of a parent method
- Message-ID: <1993Jan27.104630@cs.utwente.nl>
- Date: 27 Jan 93 09:46:30 GMT
- References: <1993Jan20.153647.25160@neptune.inf.ethz.ch> <1993Jan21.001929.29231@ucc.su.OZ.AU>
- Sender: usenet@cs.utwente.nl
- Organization: University of Twente, Dept. of Computer Science
- Lines: 56
- Nntp-Posting-Host: utis146
-
- In article <1993Jan21.001929.29231@ucc.su.OZ.AU>, maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
- |> 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 e.g.
- |> >
- |> >something like
- |> >
- |> >void B::Write (xxxxxxxxxx)
- |> > {
- |> > PARENT::Write (xxxxxxxxxxx);
- |> >
- |> > some stuff;
- |> > }
- |> >
- |> >I know this could be difficult with multiple inheritance, but I think, this could
- |> >be resolved by the compiler.
- |>
- |> From the notes on how to write a proposal
- |> for C++. A keyword 'inherited' was proposed like your
- |> PARENT:
- |>
- |> Michael Tiemann
- |> walked in and muttered something like ``but we don't need
- |> that extension; we can write code like that already.'' When
- |> the murmur of ``but of course we can't!'' had died down
- |> Michael showed us how:
- |> class foreman : public employee {
- |> typedef employee inherited;
- |> // ...
- |> void print();
- |> };
- |> class manager : public foreman {
- |> typedef foreman inherited;
- |> // ...
- |> void print();
- |> };
- |> void manager::print()
- |> {
- |> inherited::print();
- |> // ...
- |> }
-
- Hmmm. I've tried to use this construction:
- % CC typedef_inh.C
- "typedef_inh.C", line 38: error: inherited declared as employee and foreman
- "typedef_inh.C", line 47: error: qualified name employee :: print not found in
- manager
-
- If the first typedef is left out, it compiles correctly.
-
- Richard.
- --
- R.R. van de Stadt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ stadt@cs.utwente.nl
- Usually I use vi instead of xedit^[:wq
-