3 # This file illustrates the shadow-class C++ interface generated
8 # ----- Object creation -----
10 print "Creating some objects:"
11 c
= example
.Circle(10)
12 print " Created circle", c
13 s
= example
.Square(10)
14 print " Created square", s
16 # ----- Access a static member -----
18 print "\nA total of", example
.cvar
.Shape_nshapes
,"shapes were created"
20 # ----- Member data access -----
22 # Set the location of the object
30 print "\nHere is their current position:"
31 print " Circle = (%f, %f)" % (c
.x
,c
.y
)
32 print " Square = (%f, %f)" % (s
.x
,s
.y
)
34 # ----- Call some methods -----
36 print "\nHere are some properties of the shapes:"
39 print " area = ", o
.area()
40 print " perimeter = ", o
.perimeter()
42 print "\nGuess I'll clean up now"
44 # Note: this invokes the virtual destructor
49 print example
.cvar
.Shape_nshapes
,"shapes remain"