PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/trunk/Examples/python/smartptr/example.h

#
C++ Header | 39 lines | 30 code | 8 blank | 1 comment | 0 complexity | 938e14bc0055a478247b404055f0adf7 MD5 | raw file
 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