[nycphp-talk] Multi-Inheritance in PHP 5
csnyder
chsnyder at gmail.com
Sun Oct 10 14:50:44 EDT 2004
MI may be evil, but so is Flash and people still manage to use it for
good every now and then.
That said, here's a demo of how to accomplish a limited multiple
inheritance using the ClassKit extension:
<?php
class lucy {
public $isLucy = TRUE;
}
class charlie extends lucy {
public $isCharlie = "Good grief!";
}
class football {
function kickBall() {
if ( isset( $this->isLucy ) ) print "You missed!";
else print "Good kick!";
}
}
// give charlie the football
classkit_method_copy ( "charlie", "kickBall", "football" );
// charlie now extends lucy AND football
$chuck = new charlie;
print $chuck->kickBall();
?>
Verified using PHP 5.0.1 on OSX.
More information about the talk
mailing list