home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / IDIOMS.ZIP / 2-5.C < prev    next >
C/C++ Source or Header  |  1991-12-04  |  612b  |  37 lines

  1. /* Copyright (c) 1992 by AT&T Bell Laboratories. */
  2. /* Advanced C++ Programming Styles and Idioms */
  3. /* James O. Coplien */
  4. /* All rights reserved. */
  5.  
  6. class B {
  7. public:
  8.     B() { p = 0; s = 0; }
  9.     int f();
  10. private:
  11.     char *p;
  12.     short s;
  13. };
  14.  
  15. class C {
  16. public:
  17.     int g();    // no constructor
  18. private:
  19.     int i;
  20.     B b;
  21. };
  22.  
  23. class D {
  24. public:
  25.     int h();
  26. private:
  27.     int j, k;
  28. };
  29.  
  30. C gc;           // p and s initialized, i set to zero
  31.  
  32. int main() {
  33.     C c;        // p and s initialized, i undetermined
  34.     D d;        // j and k uninitialized
  35.     int l = c.g();
  36. }
  37.