The great merge

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2002-11-30 22:01:28 +00:00
commit 516036631c
1508 changed files with 125983 additions and 44037 deletions

View file

@ -0,0 +1,10 @@
example.pm
*_wrap.c
*_wrap.cxx
example.dll
example.dsw
example.ncb
example.opt
example.plg
Release
Debug

View file

@ -15,6 +15,6 @@ static::
SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_cpp_static
clean::
rm -f *_wrap* *.o *~ *.so myperl *.pyc .~* core
$(MAKE) -f $(TOP)/Makefile perl5_clean
check: all

View file

@ -11,18 +11,18 @@ void Shape::move(double dx, double dy) {
int Shape::nshapes = 0;
double Circle::area() {
double Circle::area(void) {
return M_PI*radius*radius;
}
double Circle::perimeter() {
double Circle::perimeter(void) {
return 2*M_PI*radius;
}
double Square::area() {
double Square::area(void) {
return width*width;
}
double Square::perimeter() {
double Square::perimeter(void) {
return 4*width;
}

View file

@ -10,8 +10,8 @@ public:
};
double x, y;
void move(double dx, double dy);
virtual double area() = 0;
virtual double perimeter() = 0;
virtual double area(void) = 0;
virtual double perimeter(void) = 0;
static int nshapes;
};
@ -20,8 +20,9 @@ private:
double radius;
public:
Circle(double r) : radius(r) { };
virtual double area();
virtual double perimeter();
~Circle() { };
virtual double area(void);
virtual double perimeter(void);
};
class Square : public Shape {
@ -29,8 +30,9 @@ private:
double width;
public:
Square(double w) : width(w) { };
virtual double area();
virtual double perimeter();
~Square() { }
virtual double area(void);
virtual double perimeter(void);
};

View file

@ -16,18 +16,18 @@ print " Created square $s\n";
# ----- Access a static member -----
print "\nA total of $example::Shape_nshapes shapes were created\n";
print "\nA total of $example::Shape::nshapes shapes were created\n";
# ----- Member data access -----
# Set the location of the object
# Set the location of the object.
# Note: methods in the base class Shape are used since
# x and y are defined there.
$c->{'x'} = 20;
$c->{'y'} = 30;
# Now use the same functions in the base class
$s->{'x'} = -10;
$s->{'y'} = 5;
$c->{x} = 20;
$c->{y} = 30;
$s->{x} = -10;
$s->{y} = 5;
print "\nHere is their current position:\n";
print " Circle = (",$c->{x},",", $c->{y},")\n";
@ -41,17 +41,16 @@ foreach $o ($c,$s) {
print " area = ", $o->area(), "\n";
print " perimeter = ", $o->perimeter(), "\n";
}
# Notice how the Shape_area() and Shape_perimeter() functions really
# invoke the appropriate virtual method on each object.
# ----- Delete everything -----
print "\nGuess I'll clean up now\n";
# Note: this invokes the virtual destructor
$c->DESTROY();
$s->DESTROY();
print $example::Shape_nshapes," shapes remain\n";
print $example::Shape::nshapes," shapes remain\n";
print "Goodbye\n";