Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-07-2007, 03:37 PM   PM User | #1
Sayonara
Regular Coder

 
Sayonara's Avatar
 
Join Date: Oct 2004
Location: UK
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Sayonara is an unknown quantity at this point
Quick Constructor Question

Hi all, just a quickie:

If I have class B extending class A, and both classes contain different constructors, does the creation of an object of class B cause initialisation with B's constructor only, or A's then B's?

In other words, if I want B to be initialised with properties of A, is it enough to simply extend, or do I need a call to the parent's constructor as well?
__________________
Quote:
Originally Posted by liorean
Just remember that you code for the user, and the user visits you because what you code is good.
Sayonara is offline   Reply With Quote
Old 06-07-2007, 03:45 PM   PM User | #2
kbluhm
Senior Coder

 
kbluhm's Avatar
 
Join Date: Apr 2007
Location: Philadelphia, PA, USA
Posts: 1,502
Thanks: 2
Thanked 258 Times in 254 Posts
kbluhm will become famous soon enough
This may be of some help:
http://www.hudzilla.org/phpbook/read.php/6_10_1
__________________
ZCE
kbluhm is offline   Reply With Quote
Old 06-07-2007, 04:15 PM   PM User | #3
Sayonara
Regular Coder

 
Sayonara's Avatar
 
Join Date: Oct 2004
Location: UK
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Sayonara is an unknown quantity at this point
So yes, needs a call to the parent constructor.

Thanks
__________________
Quote:
Originally Posted by liorean
Just remember that you code for the user, and the user visits you because what you code is good.
Sayonara is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:47 AM.


Advertisement
Log in to turn off these ads.