home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / IDIOMS.ZIP / 4-2.C < prev    next >
C/C++ Source or Header  |  1991-12-04  |  1KB  |  54 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. enum Bool {true, false} ;
  7.  
  8. class Telephone {
  9. public:
  10.     void ring();
  11.     Bool isOnHook();
  12.     Bool isTalking();
  13.     Bool isDialing();
  14.     DigitString collectDigits();
  15.     LineNumber extension();
  16.     ~Telephone();
  17. protected:
  18.     LineNumber extensionData;
  19.     Telephone();
  20. };
  21.  
  22. // POTS is Plain Ordinary Telephone Service
  23.  
  24. class POTSPhone: public Telephone {
  25. public:
  26.     Bool runDiagnostics();
  27.     POTSPhone();
  28.     POTSPhone(POTSPhone&);
  29.     ~POTSPhone();
  30. private:
  31.     // these are details of the phone's wiring
  32.     // connections in the telephone office
  33.     Frame frameNumberVal;
  34.     Rack rackNumberVal;
  35.     Pair pairVal;
  36. };
  37.  
  38. // ISDN is Integrated Services Digital Network
  39.  
  40. class ISDNPhone: public Telephone {
  41. public:
  42.     ISDNPhone();
  43.     ISDNPhone(ISDNPhone&);
  44.     ~ISDNPhone();
  45.     void sendBPacket();
  46.     void sendDPacket();
  47. private:
  48.     Channel b1, b2, d;
  49. };
  50.  
  51. class PrincessPhone: public POTSPhone {
  52.     . . . .
  53. };
  54.