home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 20073 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  2.4 KB

  1. 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
  2. From: stadt@cs.utwente.nl (Richard van de Stadt)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Calling of a parent method
  5. Message-ID: <1993Jan27.104630@cs.utwente.nl>
  6. Date: 27 Jan 93 09:46:30 GMT
  7. References: <1993Jan20.153647.25160@neptune.inf.ethz.ch> <1993Jan21.001929.29231@ucc.su.OZ.AU>
  8. Sender: usenet@cs.utwente.nl
  9. Organization: University of Twente, Dept. of Computer Science
  10. Lines: 56
  11. Nntp-Posting-Host: utis146
  12.  
  13. In article <1993Jan21.001929.29231@ucc.su.OZ.AU>, maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  14. |> In article <1993Jan20.153647.25160@neptune.inf.ethz.ch> mhof@iiic.ethz.ch (Markus Alexander Hof) writes:
  15.  
  16. |> >My question now: Is therea way to specify a call to a method of your immediate parent,
  17. |> >without naming him, so that is is possible to insert an intermeddiate class without
  18. |> >having to cchange the son e.g.
  19. |> >
  20. |> >something like
  21. |> >
  22. |> >void B::Write (xxxxxxxxxx)
  23. |> >    {
  24. |> >    PARENT::Write (xxxxxxxxxxx);
  25. |> >
  26. |> >    some stuff;
  27. |> >    }
  28. |> >
  29. |> >I know this could be difficult with multiple inheritance, but I think, this could
  30. |> >be resolved by the compiler.
  31. |> 
  32. |>     From the notes on how to write a proposal
  33. |> for C++. A keyword 'inherited' was proposed like your
  34. |> PARENT:
  35. |> 
  36. |> Michael Tiemann
  37. |> walked in and muttered something like ``but  we  don't  need
  38. |> that extension; we can write code like that already.''  When
  39. |> the murmur of ``but of course  we  can't!''  had  died  down
  40. |> Michael showed us how:
  41. |>      class foreman : public employee {
  42. |>          typedef employee inherited;
  43. |>          // ...
  44. |>          void print();
  45. |>      };
  46. |>      class manager : public foreman {
  47. |>          typedef foreman inherited;
  48. |>          // ...
  49. |>          void print();
  50. |>      };
  51. |>      void manager::print()
  52. |>      {
  53. |>          inherited::print();
  54. |>          // ...
  55. |>      }
  56.  
  57. Hmmm. I've tried to use this construction:
  58. % CC typedef_inh.C
  59. "typedef_inh.C", line 38: error:  inherited  declared as  employee  and  foreman 
  60. "typedef_inh.C", line 47: error:  qualified name employee :: print not found in 
  61. manager
  62.  
  63. If the first typedef is left out, it compiles correctly.
  64.  
  65. Richard.
  66. -- 
  67. R.R. van de Stadt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ stadt@cs.utwente.nl
  68. Usually I use vi instead of xedit^[:wq
  69.