PageRenderTime 36ms CodeModel.GetById 23ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/chicken/class/example.h

#
C++ Header | 46 lines | 36 code | 9 blank | 1 comment | 0 complexity | c082b529a8b0f31f1059e9f73fef6246 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(void) = 0;
14  virtual double perimeter(void) = 0;
15  static  int nshapes;
16
17  enum SomeEnum {
18    First = 0,
19    Second,
20    Third,
21    Last = 1000
22  };
23};
24
25class Circle : public Shape {
26private:
27  double radius;
28public:
29  Circle(double r) : radius(r) { };
30  virtual double area(void);
31  virtual double perimeter(void);
32};
33
34class Square : public Shape {
35private:
36  double width;
37public:
38  Square(double w) : width(w) { };
39  virtual double area(void);
40  virtual double perimeter(void);
41};
42
43
44
45
46