PageRenderTime 19ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-29/SWIG/Examples/php4/shadow/example.h

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