Extends Construct?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Extends Construct?

Post by infolock »

I am pretty sure I could write a quick test to see if this happens or not, but figured i would just ask since I had about 18 other things going on at once hah.

If you extend a class, does this call the __construct() of the class you are extending to? Thanks :)
WebbieDave
Forum Contributor
Posts: 213
Joined: Sun Jul 15, 2007 7:07 am

Re: Extends Construct?

Post by WebbieDave »

from: http://us.php.net/manual/en/language.oop5.decon.php

"Parent constructors are not called implicitly if the child class defines a constructor. In order to run a parent constructor, a call to parent::__construct() within the child constructor is required."
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Re: Extends Construct?

Post by infolock »

what i was looking for. thanks :)
Post Reply