home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18279 < prev    next >
Encoding:
Text File  |  1992-12-21  |  1.1 KB  |  68 lines

  1. Path: sparky!uunet!utcsri!relay.cs.toronto.edu!compuserve.com!76336.3114
  2. Newsgroups: comp.lang.c++
  3. From: 76336.3114@CompuServe.COM (Kevin Dean)
  4. Subject: How to turn PC speaker off
  5. Message-ID: <921221185052_76336.3114_EHJ5-1@CompuServe.COM>
  6. Date: 21 Dec 92 18:55:34 GMT
  7. Lines: 59
  8.  
  9. C.S. Chang (cschang@umd5.umd.edu) writes:
  10.  
  11. >Is there any way to turn the PC speaker off so that there will be no
  12. >beeps if a certain function call failed. 
  13.  
  14. class PowerCase {
  15.   friend class ScrewDriver;
  16.   friend class Pliers;
  17.  
  18.   Screws _screws[6];
  19.   Speaker _speaker;
  20.   // ... other private items here.
  21.   
  22.   void open();
  23.   void close();
  24.  
  25.   public:
  26.  
  27.   void powerOn();
  28.   void powerOff(); 
  29.   };
  30.  
  31. class Screwdriver {
  32.   // ...
  33.  
  34.   void undo(Screw & s);
  35.  
  36.   public:
  37.  
  38.   void openPowerCase(PowerCase & pc) {
  39.   for (int i = 0; i < 6; i++)
  40.     undo(pc._screws[i]);
  41.   pc.open();
  42.   }
  43.   };
  44.  
  45. class Pliers {
  46.   void cut(Wire & w);
  47.   public:
  48.  
  49.   void disableSpeaker(PowerCase & pc) {
  50.   cut(pc._speaker._wire);
  51.   }
  52.   };
  53.  
  54. main() {
  55. PowerCase pc;
  56. ScrewDriver sd;
  57. Pliers p;
  58.  
  59. sd.openPowerCase(pc);
  60. p.disableSpeaker(pc);
  61.  
  62. return (0); 
  63. }
  64.  
  65. That should do it, I think.
  66.  
  67.  
  68.