home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / IOC / GRAPH / CIRCLE.H < prev    next >
Text File  |  1995-03-15  |  2KB  |  66 lines

  1. /*************************************************************************
  2.   IBM C/C++ Tools Version 3.00 - Collection Class Library
  3.  (C) Copyright IBM Corporation 1992 ,1995, Licensed Program-Property of
  4.  IBM.  All Rights Reserved.  US Government Users Restricted Rights - Use,
  5.  duplication or disclosure restricted by GSA ADP Schedule Contract with
  6.  IBM Corp.
  7.  *************************************************************************/
  8.  
  9. #if defined (_SUN)
  10. #include <istring.h>
  11. #else
  12. #include <istring.hpp>
  13. #endif
  14.  
  15. class Circle : public Graphics
  16. {
  17. public:
  18.  
  19.   float ivXCenter;
  20.   float ivYCenter;
  21.   float ivRadius;
  22.  
  23.  
  24.   Circle(int graphicsKey, IString id ,
  25.          double xCenter, double yCenter,
  26.          double radius)
  27.                           : Graphics(graphicsKey, id),
  28.                             ivXCenter(xCenter),
  29.                             ivYCenter(yCenter),
  30.                             ivRadius(radius)
  31.                             { }
  32.  
  33.  
  34.   IBoolean operator== (Circle const& circle) const
  35.     {
  36.      return (this->ivXCenter == circle.ivXCenter &&
  37.              this->ivYCenter == circle.ivYCenter &&
  38.              this->ivRadius == circle.ivRadius);
  39.     }
  40.  
  41.  
  42.   void          draw() const
  43.     {
  44.      cout << "drawing "
  45.           << Graphics::id()
  46.           << endl
  47.           << "with center: "
  48.           << "(" << this->ivXCenter << "|"
  49.           << this->ivYCenter << ")"
  50.           << " and with radius: "
  51.           << this->ivRadius
  52.           << endl;
  53.     }
  54.  
  55.  
  56.   void          circumference() const
  57.     {
  58.      cout << "The circumference of "
  59.           << Graphics::id()
  60.           << " is: "
  61.           << ((this->ivRadius)*2*3.14)
  62.           << endl;
  63.     }
  64.  
  65. };
  66.