Re: constructor in php4?

From: Date: Sun, 21 Apr 2002 20:44:04 +0000
Subject: Re: constructor in php4?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-93909@lists.php.net to get a copy of this message
Well its going to execute from the class in which you created the object thats how OOP works. In article <00p4cu06mh7vmsvkcds8i64gqkldqqc3bu@4ax.com>, lly200146@sohu.com (Bob) wrote: > the manual says:the function A will be called. > in fact, the function B is called. > why? > my config : win98/pws2/php411(CGI) > > <?php > class A > { > function A() > { > echo "I am the constructor of A.<br>\n"; > } > > function B() > { > echo "I am a regular function named B in class A.<br>\n"; > echo "I am not a constructor in A.<br>\n"; > } > } > > class B extends A > { > function C() > { > echo "I am a regular function.<br>\n"; > } > } > > // This will call B() as a constructor. > $b = new B; > ?> > > thaks

« previous php.general (#93909) next »