~ubuntu-branches/ubuntu/edgy/swig1.3/edgy

« back to all changes in this revision

Viewing changes to Examples/php4/shadow/runme.php4

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-12-05 01:16:04 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051205011604-ygx904it6413k3go
Tags: 1.3.27-1ubuntu1
Resynchronise with Debian again, for the new subversion packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
# ----- Object creation -----
10
10
 
11
11
print "Creating some objects:\n";
12
 
$c = new Circle(10);
13
 
print "    Created circle $c\n";
 
12
$c = CircleFactory(10);
 
13
print "    Created circle $c with area ". $c->area() ."\n";
14
14
$s = new Square(10);
15
15
print "    Created square $s\n";
16
16
 
38
38
print "\nHere are some properties of the shapes:\n";
39
39
foreach (array($c,$s) as $o) {
40
40
      print "    ".get_class($o)." $o\n";
 
41
      print "        x         = " .  $o->x . "\n";
 
42
      print "        y         = " .  $o->y . "\n";
41
43
      print "        area      = " .  $o->area() . "\n";
42
44
      print "        perimeter = " .  $o->perimeter() . "\n";
43
45
  }
44
46
 
 
47
# Need to unset($o) or else we hang on to a reference to the Square object.
 
48
unset($o);
 
49
 
45
50
# ----- Delete everything -----
46
51
 
47
52
print "\nGuess I'll clean up now\n";
48
53
 
49
54
# Note: this invokes the virtual destructor
50
 
 
51
 
# This causes a seq fault, possibly php trying to call destructor twice ?
52
 
#$c->_destroy();
53
 
#$s->_destroy();
 
55
unset($c);
 
56
$s = 42;
54
57
 
55
58
print Shape::nshapes() . " shapes remain\n";
 
59
 
 
60
print "Manually setting nshapes\n";
 
61
 
 
62
Shape::nshapes(42);
 
63
 
 
64
print Shape::get_nshapes() ." == 42\n";
 
65
 
56
66
print "Goodbye\n";
57
67
 
58
68
?>