home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C14 / Hide.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  553 b   |  27 lines

  1. //: C14:Hide.cpp
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // Name hiding during inheritance
  7.  
  8. class Homer {
  9. public:
  10.   int doh(int) const { return 1; }
  11.   char doh(char) const { return 'd';}
  12.   float doh(float) const { return 1.0; }
  13. };
  14.  
  15. class Bart : public Homer {
  16. public:
  17.   class Milhouse {};
  18.   void doh(Milhouse) const {}
  19. };
  20.  
  21. int main() {
  22.   Bart b;
  23. //! b.doh(1); // Error
  24. //! b.doh('x'); // Error
  25. //! b.doh(1.0); // Error
  26. } ///:~
  27.