PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1.3.35/Examples/python/shadow/example.cxx

#
C++ | 31 lines | 22 code | 7 blank | 2 comment | 0 complexity | ced69823d71d68c9039f00cbb32783be MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /* File : example.c */
  2. #include "example.h"
  3. #include <math.h>
  4. #ifndef M_PI
  5. # define M_PI 3.14159265358979323846
  6. #endif
  7. /* Move the shape to a new location */
  8. void Shape::move(double dx, double dy) {
  9. x += dx;
  10. y += dy;
  11. }
  12. int Shape::nshapes = 0;
  13. double Circle::area() {
  14. return M_PI*radius*radius;
  15. }
  16. double Circle::perimeter() {
  17. return 2*M_PI*radius;
  18. }
  19. double Square::area() {
  20. return width*width;
  21. }
  22. double Square::perimeter() {
  23. return 4*width;
  24. }