On Fri, 2006-03-24 at 00:40, Peter Lauri wrote: > Hi, > > I have a class B that extends class A. I want to call constructor of A > correctly, how to do that. This is how I tried: > > Class B extends A { > Function B($Bvariable) { > Parent::A($Bvariable); > } > > } > > Class A { > Function A($Avariable) { > Dostuff... > } > } > > It does not seem correct, maybe I am correct, but I do not feel correct. <?php Class A { function __construct( $Avariable ) { // Do stuff... } function A( $Avariable ) { $this->__construct( $Avariable ); } } Class B extends A { function __construct( $Bvariable ) { parent::__construct( $Bvariable ); } function B( $Bvariable ) { $this->__construct( $Bvariable ); } } ?> Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php