3 # This file illustrates the low-level C++ interface
4 # created by SWIG. In this case, all of our C++ classes
5 # get converted into function calls.
7 require("example.php");
9 # ----- Object creation -----
11 print "Creating some objects:\n";
13 print " Created circle $c\n";
15 print " Created square $s\n";
17 # ----- Create the ShapeContainer ----
19 $container = new ShapeContainer();
21 $container->addShape($c);
22 $container->addShape($s);
24 # ----- Access a static member -----
26 print "\nA total of " . Shape::nshapes() . " shapes were created\n";
28 # ----- Delete by the old references -----
29 # This should not truely delete the shapes because they are now owned
30 # by the ShapeContainer.
32 print "Delete the old references.";
34 # Note: this invokes the virtual destructor
38 print "\nA total of " . Shape::nshapes() . " shapes remain\n";
40 # ----- Delete by the container -----
41 # This should truely delete the shapes
43 print "Delete the container.";
45 print "\nA total of " . Shape::nshapes() . " shapes remain\n";