~ubuntu-branches/ubuntu/maverick/swig1.3/maverick

« back to all changes in this revision

Viewing changes to Examples/java/class/example.h

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Landschoff
  • Date: 2002-03-29 01:56:07 UTC
  • Revision ID: james.westby@ubuntu.com-20020329015607-c0wt03xu8oy9ioj7
Tags: upstream-1.3.11
ImportĀ upstreamĀ versionĀ 1.3.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* File : example.h */
 
2
 
 
3
class Shape {
 
4
public:
 
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
 
 
18
class Circle : public Shape {
 
19
private:
 
20
  double radius;
 
21
public:
 
22
  Circle(double r) : radius(r) { };
 
23
  virtual double area(void);
 
24
  virtual double perimeter(void);
 
25
};
 
26
 
 
27
class Square : public Shape {
 
28
private:
 
29
  double width;
 
30
public:
 
31
  Square(double w) : width(w) { };
 
32
  virtual double area(void);
 
33
  virtual double perimeter(void);
 
34
};
 
35
 
 
36
 
 
37
 
 
38
 
 
39