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 7require("example.php"); 8 9# ----- Object creation ----- 10 11print "Creating some objects:\n"; 12$c = new Circle(10); 13print " Created circle \$c\n"; 14$s = new Square(10); 15print " 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 26print "\nA total of " . Shape::nshapes() . " shapes were created\n"; 27 28# ----- Delete by the old references ----- 29# This should not truly delete the shapes because they are now owned 30# by the ShapeContainer. 31 32print "Delete the old references."; 33 34# Note: this invokes the virtual destructor 35$c = NULL; 36$s = NULL; 37 38print "\nA total of " . Shape::nshapes() . " shapes remain\n"; 39 40# ----- Delete by the container ----- 41# This should truly delete the shapes 42 43print "Delete the container."; 44$container = NULL; 45print "\nA total of " . Shape::nshapes() . " shapes remain\n"; 46 47print "Goodbye\n"; 48 49?> 50