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

/trunk/Examples/xml/example_xml.h

#
C++ Header | 39 lines | 30 code | 8 blank | 1 comment | 0 complexity | 48798b1e92f24205dc5115e612632a2f 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