import source from 1.3.40
[external/swig.git] / Examples / chicken / class / example.cxx
1 /* File : example.c */
2
3 #include "example.h"
4 #define M_PI 3.14159265358979323846
5
6 /* Move the shape to a new location */
7 void Shape::move(double dx, double dy) {
8   x += dx;
9   y += dy;
10 }
11
12 int Shape::nshapes = 0;
13
14 double Circle::area(void) {
15   return M_PI*radius*radius;
16 }
17
18 double Circle::perimeter(void) {
19   return 2*M_PI*radius;
20 }
21
22 double Square::area(void) {
23   return width*width;
24 }
25
26 double Square::perimeter(void) {
27   return 4*width;
28 }