RE: [PHP] Object question? Super class

From: Date: Fri, 27 Oct 2000 13:41:23 +0000
Subject: RE: [PHP] Object question? Super class
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-22328@lists.php.net to get a copy of this message
Hi Juan, > Can i reference in a object to a method of a superclass > > class a { > function metodo_redefinido() { > } > } > > class b extends a { > function metodo_redefinido() { > $super->metodo_redefinido(); > // How can i reference a method of the superclass?? > } > } > > > $MyObject=new $b; > $b->metodo_redefinido(); unlike Java there's no super in PHP. But there's a way around this if you're using PHP4. <?php class a { function metodo_redefinido() { } } class b extends a { function metodo_redefinido() { a::metodo_redefinido(); } } ?> Cheers, Matthias

« previous php.general (#22328) next »