home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / cplus / 18167 < prev    next >
Encoding:
Text File  |  1992-12-20  |  1.2 KB  |  38 lines

  1. Path: sparky!uunet!olivea!spool.mu.edu!umn.edu!csus.edu!netcom.com!netcomsv!ulogic!hartman
  2. From: hartman@ulogic.UUCP (Richard M. Hartman)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Who is wrong? me, BC , GNUC ?
  5. Message-ID: <748@ulogic.UUCP>
  6. Date: 18 Dec 92 01:18:09 GMT
  7. References: <1992Dec8.184713.7544@taumet.com> <718@ulogic.UUCP> <1992Dec14.172921.18638@cci632.cci.com>
  8. Organization: negligable
  9. Lines: 27
  10.  
  11. So it is then impossible to selectively override one of a set
  12. of inheirited functions of the same name.  In order to accomplish
  13. this we have to override the one we want, the put "passthrough"
  14. inline member functions in for the rest, e.g.:
  15.  
  16. class A {
  17.     A &operator += (A &);
  18.     A &operator += (int);
  19.     };
  20.  
  21. class B : public A {
  22.     {
  23.     B &operator += (int);
  24.     A &operator += (A &a) { return *((A *) this) += a; }
  25.     };
  26.  
  27. is this an accurate summary?
  28.  
  29. (the inline may perhaps need a different declaration:
  30.     A &operator += (A &a) { return A::operator+=(a); }
  31. I really haven't tried this....)
  32.  
  33. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  34. Between the silence of the mountains    |
  35. and the crashing of the sea         |    -Richard Hartman    
  36. there lies a land I once lived in    |    hartman@uLogic.COM
  37. and she's waiting there for me.        |
  38.