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

  1. //: C14:Compose2.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. // Private embedded objects
  7. #include "Useful.h"
  8.  
  9. class Y {
  10.   int i;
  11.   X x; // Embedded object
  12. public:
  13.   Y() { i = 0; }
  14.   void f(int ii) { i = ii; x.set(ii); }
  15.   int g() const { return i * x.read(); }
  16.   void permute() { x.permute(); }
  17. };
  18.  
  19. int main() {
  20.   Y y;
  21.   y.f(47);
  22.   y.permute();
  23. } ///:~
  24.