Conflicts: .project COPYRIGHT Doc/Manual/style.css Examples/Makefile.in Examples/test-suite/common.mk Lib/typemaps/strings.swg Makefile.in Source/DOH/fio.c Source/Makefile.am Source/Modules/emit.cxx Source/Modules/javascript.cxx configure.in git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13764 626c5289-ae23-0410-ae9c-e8d60b6d4f22
28 lines
457 B
C++
Executable file
28 lines
457 B
C++
Executable file
/* File : example.c */
|
|
#include <iostream>
|
|
#include "example.h"
|
|
#define M_PI 3.14159265358979323846
|
|
|
|
/* Move the shape to a new location */
|
|
void Shape::move(double dx, double dy) {
|
|
x += dx;
|
|
y += dy;
|
|
}
|
|
|
|
int Shape::nshapes = 0;
|
|
|
|
double Circle::area(void) {
|
|
return M_PI*radius*radius;
|
|
}
|
|
|
|
double Circle::perimeter(void) {
|
|
return 2*M_PI*radius;
|
|
}
|
|
|
|
double Square::area(void) {
|
|
return width*width;
|
|
}
|
|
|
|
double Square::perimeter(void) {
|
|
return 4*width;
|
|
}
|