CMake/Tests/SwigTest/example.cxx

34 lines
450 B
C++
Raw Normal View History

2004-04-30 20:17:06 +04:00
/* File : example.c */
#include "example.h"
#define M_PI 3.14159265358979323846
/* Move the shape to a new location */
void Shape::move(double dx, double dy)
{
2004-04-30 20:17:06 +04:00
x += dx;
y += dy;
}
int Shape::nshapes = 0;
double Circle::area(void)
{
return M_PI * radius * radius;
2004-04-30 20:17:06 +04:00
}
double Circle::perimeter(void)
{
return 2 * M_PI * radius;
2004-04-30 20:17:06 +04:00
}
double Square::area(void)
{
return width * width;
2004-04-30 20:17:06 +04:00
}
double Square::perimeter(void)
{
return 4 * width;
2004-04-30 20:17:06 +04:00
}