FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » out of sheer curiosity...
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: out of sheer curiosity... [message #177613 is a reply to message #177594] Tue, 10 April 2012 21:20 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 4/10/2012 12:18 PM, Thomas Mlynarczyk wrote:
> Jerry Stuckle schrieb:
>
>> Yes, but the parent is also an object, and the system should call the
>> constructor for you. Otherwise you may have an uninitialized parent.
>
> No. When you instantiate the child, then the child is an object, but
> there is no instance of a "parent object".
>
> Greetings,
> Thomas
>

Although not a separate entity, the parent is still considered an
object. You can, for instance, call public methods which are defined in
the parent but not the child. Those methods will operate on the parent,
just as if you had a parent object.

So basically what you have is "dual identity" - the object is considered
both a parent and a child, depending on the context.

And the parent's constructor is responsible for constructing the parent
object; the child is only responsible for constructing the child object.

This is actually quite important. This allows you to change the
implementation (code and private variables) of the parent object without
affecting any child objects.

Remember that the child object always has a parent object; the opposite
is not necessarily true, and the parent object should not depend on
anything in the child (abstract classes are a special case - but even
then the parent should never depend on anything in the child).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 5.4 windows installer.
Next Topic: Does PHP5 treat $_SERVER['PHP_AUTH_USER']) differently?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 13:51:54 GMT 2024

Total time taken to generate the page: 0.07191 seconds