Mailinglisten-Archive |
----- Original Message -----
From: "markus espenhain" <metwo at gmx.net>
> ich moechte die methode eines objektes ueberschreiben ...
Was Du möchtest nennt man "Polymorphismus" und funktioniert
am einfachsten per Vererbung:
class a {
function myMethod() {
echo "irgendwas";
}
function myOtherMethod() {
echo "hello world";
}
}
class b extends a {
function myMethod() {
echo "foobar";
}
}
$a = new a();
// gibt "irgendwas" aus
$a->myMethod();
// gibt "hello world" aus
$a->myOtherMethod();
$b = new b();
// gibt "foobar" aus
$b->myMethod();
// gibt "hello world" aus
$b->myOtherMethod();
Gruss,
Andreas
--
http://www.andreas-demmer.de | http://www.mediadb.net
php::bar PHP Wiki - Listenarchive