RE: [PHP] Object question? Super class

From: Date: Fri, 27 Oct 2000 13:52:59 +0000
Subject: RE: [PHP] Object question? Super class
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-22331@lists.php.net to get a copy of this message
In PHP 4.0 (as of 4.0.2), you can use parent::method_name(). The special word 'parent' will always refer to the parent class. Zeev On Fri, 27 Oct 2000, Matthias Endler wrote: > 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 > > > -- Zeev Suraski <zeev@zend.com> http://www.zend.com/

« previous php.general (#22331) next »