PageRenderTime 14ms CodeModel.GetById 1ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/trunk/Examples/pike/class/example.h

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