home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / ioc / graph / circle.h next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  2.3 KB  |  71 lines

  1. /**********************************************************************
  2. *                                                                     *
  3. *  IBM(R) VisualAge(TM) for C++ for Windows(R), Version 3.5           *
  4. *                                                                     *
  5. *  PID: 5622-880                                                      *
  6. *  - Licensed Material - Program-Property of IBM                      *
  7. *  (C) Copyright IBM Corp. 1991, 1995 - All Right Reserved.           *
  8. *                                                                     *
  9. *  US Government Users Restricted Rights - Use, duplication or        *
  10. *  disclosure restricted by GSA ADP Schedule Contract with IBM Corp.  *
  11. *                                                                     *
  12. *  VisualAge, and IBM are trademarks or registered trademarks of      *
  13. *  International Business Machines Corporation.                       *
  14. *  Windows is a registered trademark of Microsoft Corporation.        *
  15. *                                                                     *
  16. **********************************************************************/
  17.  
  18. #include <istring.hpp>
  19.  
  20. class Circle : public Graphics
  21. {
  22. public:
  23.  
  24.   float ivXCenter;
  25.   float ivYCenter;
  26.   float ivRadius;
  27.  
  28.  
  29.   Circle(int graphicsKey, IString id ,
  30.          double xCenter, double yCenter,
  31.          double radius)
  32.                           : Graphics(graphicsKey, id),
  33.                             ivXCenter(xCenter),
  34.                             ivYCenter(yCenter),
  35.                             ivRadius(radius)
  36.                             { }
  37.  
  38.  
  39.   IBoolean operator== (Circle const& circle) const
  40.     {
  41.      return (this->ivXCenter == circle.ivXCenter &&
  42.              this->ivYCenter == circle.ivYCenter &&
  43.              this->ivRadius == circle.ivRadius);
  44.     }
  45.  
  46.  
  47.   void          draw() const
  48.     {
  49.      cout << "drawing "
  50.           << Graphics::id()
  51.           << endl
  52.           << "with center: "
  53.           << "(" << this->ivXCenter << "|"
  54.           << this->ivYCenter << ")"
  55.           << " and with radius: "
  56.           << this->ivRadius
  57.           << endl;
  58.     }
  59.  
  60.  
  61.   void          circumference() const
  62.     {
  63.      cout << "The circumference of "
  64.           << Graphics::id()
  65.           << " is: "
  66.           << ((this->ivRadius)*2*3.14)
  67.           << endl;
  68.     }
  69.  
  70. };
  71.