PageRenderTime 35ms CodeModel.GetById 19ms app.highlight 7ms RepoModel.GetById 3ms app.codeStats 0ms

/tags/ttn-post-libtool-1-4-3-upgrade/SWIG/Examples/perl5/class/example.cxx

#
C++ | 28 lines | 19 code | 7 blank | 2 comment | 0 complexity | fd4e0fb0eb772486d019293f797d00c9 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
 1/* File : example.c */
 2
 3#include "example.h"
 4#define M_PI 3.14159265358979323846
 5
 6/* Move the shape to a new location */
 7void Shape::move(double dx, double dy) {
 8  x += dx;
 9  y += dy;
10}
11
12int Shape::nshapes = 0;
13
14double Circle::area(void) {
15  return M_PI*radius*radius;
16}
17
18double Circle::perimeter(void) {
19  return 2*M_PI*radius;
20}
21
22double Square::area(void) {
23  return width*width;
24}
25
26double Square::perimeter(void) {
27  return 4*width;
28}