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

« back to all changes in this revision

Viewing changes to Examples/ruby/mpointer/example.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-12-06 10:27:08 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20071206102708-t37t62i45n595w0e
Tags: 1.3.33-2ubuntu1
* Merge with Debian; remaining changes:
  - Drop support for pike.
  - Use python2.5 instead of python2.4.
  - Clean Runtime/ as well.
  - Force a few environment variables.
* debian/Rules (clean): Remove Lib/ocaml/swigp4.ml.

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
 
  double  *z;
13
 
 
14
 
  void    move(double dx, double dy);
15
 
  virtual double area(void) = 0;
16
 
  virtual double perimeter(void) = 0;
17
 
  static  int nshapes;
18
 
};
19
 
 
20
 
class Circle : public Shape {
21
 
private:
22
 
  double radius;
23
 
public:
24
 
  Circle(double r) : radius(r) { };
25
 
  virtual double area(void);
26
 
  virtual double perimeter(void);
27
 
};
28
 
  
29
 
class Square : public Shape {
30
 
private:
31
 
  double width;
32
 
public:
33
 
  Square(double w) : width(w) { };
34
 
  virtual double area(void);
35
 
  virtual double perimeter(void);
36
 
};
37
 
 
38
 
extern double do_op(Shape *s, double (Shape::*m)(void));
39
 
 
40
 
/* Functions that return member pointers */
41
 
 
42
 
extern double (Shape::*areapt())(void);
43
 
extern double (Shape::*perimeterpt())(void);
44
 
 
45
 
/* Global variables that are member pointers */
46
 
extern double (Shape::*areavar)(void);
47
 
extern double (Shape::*perimetervar)(void);