import source from 1.3.40
[external/swig.git] / Examples / contract / simple_cxx / runme3.py
1 import example 
2
3 # Create the Circle object
4
5 r = 2;
6 print "  Creating circle (radium: %d) :" % r
7 c = example.Circle(r)
8
9 # Set the location of the object
10
11 c.x = 20
12 c.y = 30
13 print "  Here is its current position:"
14 print "    Circle = (%f, %f)" % (c.x,c.y)
15
16 # ----- Call some methods -----
17
18 print "\n  Here are some properties of the Circle:"
19 print "    area      = ", c.area()
20 print "    perimeter = ", c.perimeter()
21 dx = 1;
22 dy = 1;
23 print "    Moving with (%d, %d)..." % (dx, dy)
24 c.move(dx, dy)
25
26 del c
27
28 print "==================================="
29
30 # test move function */
31 r = 2;
32 print "  Creating circle (radium: %d) :" % r 
33 c = example.Circle(r)
34 # Set the location of the object
35
36 c.x = 20
37 c.y = 30
38 print "  Here is its current position:"
39 print "    Circle = (%f, %f)" % (c.x,c.y)
40
41 # ----- Call some methods -----
42
43 print "\n  Here are some properties of the Circle:"
44 print "    area      = ", c.area()
45 print "    perimeter = ", c.perimeter()
46
47 # no error for Circle's pre-assertion
48 dx = 1;
49 dy = -1;
50 print "    Moving with (%d, %d)..." % (dx, dy)
51 c.move(dx, dy)
52
53 # error with Shape's pre-assertion
54 dx = -1;
55 dy = 1;
56 print "    Moving with (%d, %d)..." % (dx, dy)
57 c.move(dx, dy)