import source from 1.3.40
[external/swig.git] / Examples / php / disown / runme.php
1 <?php
2
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.
6
7 require("example.php");
8
9 # ----- Object creation -----
10
11 print "Creating some objects:\n";
12 $c = new Circle(10);
13 print "    Created circle $c\n";
14 $s = new Square(10);
15 print "    Created square $s\n";
16
17 # ----- Create the ShapeContainer ----
18
19 $container = new ShapeContainer();
20
21 $container->addShape($c);
22 $container->addShape($s);
23
24 # ----- Access a static member -----
25
26 print "\nA total of " . Shape::nshapes() . " shapes were created\n";
27
28 # ----- Delete by the old references -----
29 # This should not truely delete the shapes because they are now owned
30 # by the ShapeContainer.
31
32 print "Delete the old references.";
33
34 # Note: this invokes the virtual destructor
35 $c = NULL;
36 $s = NULL;
37
38 print "\nA total of " . Shape::nshapes() . " shapes remain\n";
39
40 # ----- Delete by the container -----
41 # This should truely delete the shapes
42
43 print "Delete the container.";
44 $container = NULL;
45 print "\nA total of " . Shape::nshapes() . " shapes remain\n";
46
47 print "Goodbye\n";
48
49 ?>