Re: Using a Resource as a Class Property
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Mon, 23 Jul 2007 12:16:49 -0400
Sanders Kaufman wrote:
Toby A Inkster wrote:Sanders Kaufman wrote:
So extended (child?) classes MUST NOT (for OOP reasons) automatically call a constructor. Rather, it should be called manually, if and when it's desired.
s/MUST NOT/DO NOT/
Of course, if you don't define a __construct() method in the child
class, the parent class' constructor will get called automatically.
Basically, in PHP __construct() behaves the same way other methods
do: if you define the method in a child class, the parent class'
method will be ignored, unless you explicitly call it from within
the child class' method (using "parent::method()").
So to correct my statement:
In OOP (not just PHP) the constructor of the grandest child :) will be called when a class is instantiated as an object.
True. And in true OO languages, the parent constructor(s) is(are) called, also.
Zat right?
Vocabulary question: When I do this, what is the OOP thing that I'm doing? You said that my use of an object as a property of the parent class was "aggregation. So - when I use use "extends" to create the child's reference to the parent - wassat? Marshalling? Inheritance?
Inheritance.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- Follow-Ups:
- Re: Using a Resource as a Class Property
- From: Sanders Kaufman
- Re: Using a Resource as a Class Property
- References:
- Using a Resource as a Class Property
- From: Sanders Kaufman
- Re: Using a Resource as a Class Property
- From: Michael Fesser
- Re: Using a Resource as a Class Property
- From: Sanders Kaufman
- Re: Using a Resource as a Class Property
- From: Michael Fesser
- Re: Using a Resource as a Class Property
- From: Sanders Kaufman
- Re: Using a Resource as a Class Property
- From: Michael Fesser
- Re: Using a Resource as a Class Property
- From: Sanders Kaufman
- Re: Using a Resource as a Class Property
- From: Michael Fesser
- Re: Using a Resource as a Class Property
- From: Sanders Kaufman
- Re: Using a Resource as a Class Property
- From: Michael Fesser
- Re: Using a Resource as a Class Property
- From: Sanders Kaufman
- Re: Using a Resource as a Class Property
- From: Toby A Inkster
- Re: Using a Resource as a Class Property
- From: Sanders Kaufman
- Using a Resource as a Class Property
- Prev by Date: Re: Using a Resource as a Class Property
- Next by Date: Re: Number of CPUs using PHP?
- Previous by thread: Re: Using a Resource as a Class Property
- Next by thread: Re: Using a Resource as a Class Property
- Index(es):
Relevant Pages
|