PageRenderTime 29ms CodeModel.GetById 22ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/rel-1-3-25/SWIG/Examples/python/smartptr/example.h

#
C++ Header | 39 lines | 30 code | 8 blank | 1 comment | 0 complexity | 938e14bc0055a478247b404055f0adf7 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
 1/* File : example.h */
 2
 3class Shape {
 4public:
 5  Shape() {
 6    nshapes++;
 7  }
 8  virtual ~Shape() {
 9    nshapes--;
10  };
11  double  x, y;   
12  void    move(double dx, double dy);
13  virtual double area() = 0;
14  virtual double perimeter() = 0;
15  static  int nshapes;
16};
17
18class Circle : public Shape {
19private:
20  double radius;
21public:
22  Circle(double r) : radius(r) { };
23  virtual double area();
24  virtual double perimeter();
25};
26  
27class Square : public Shape {
28private:
29  double width;
30public:
31  Square(double w) : width(w) { };
32  virtual double area();
33  virtual double perimeter();
34};
35
36
37
38
39