Re: extending built in classes?

From: Date: Sat, 09 Oct 2004 16:31:19 +0000
Subject: Re: extending built in classes?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-199074@lists.php.net to get a copy of this message
Dc wrote: > Hi - > > I am trying to extend a built in class, but cannot seem to get my > subclass methods called. > > class movObj extends SWFMovie { > function init() { > echo("init"); > } > } > > $m = new movObj(); > $m->init(); > > Gives::: > Fatal error: Call to undefined method SWFMovie::init() ... > > This method call i would have hoped would pass up to the baseclass. > > But if I add a constructor to my own subclass, the init method can be > called. BUT i can now not call any of the SWFMovie methods. Like, it > is not really extending the built in class, or there is no hierarchy. > > I messed with various versiosn of trying to call the super myself: > > parent::method > $this->parent->method() > > without much success. > > Is this a limitation of phps classes? We cannot subclass built in types > (perhaps they were built/not compatible with php5 object model)? > > thanks! > are you using php 4 or 5?

« previous php.general (#199074) next »