|
Posted by Sanders Kaufman on 07/23/07 13:26
Jerry Stuckle wrote:
> Sanders Kaufman wrote:
>> I seriously considered writing the classes in a way to where the
>> parent would *presume* all kinds of stuff about the child, but it
>> didn't jibe with my obsession with atomicity - so I didn't do it.
>
> The child class defines the derivation, and therefore knows it has a
> parent class (and some things about that parent). However, the parent
> doesn't know if (or when) it is being used as a base class, so it should
> never assume things which may or may not be there (or set).
So - it's okay in the purist of OOP to have a child that presumes things
about the parent, but not t'other way 'round?
That makes a little better sense. I was kinda beginning to wonder what
use there was to having a child that couldn't (or shouldn't) talk to its
parent.
All of my classes talk with their parents, and I was thinking I might be
doing something non-OOP there.
Parent. Parents. Hmmm. That takes me to a new question - I understand
that a PHP class be an extension of more than one parent class.
(e.g. "class myClass extends oMommy, oDaddy") Are there any common
pitfalls y'all wanna warn me about before I start adding that way to my
mind's toolbox?
I haven't started doing it that way yet because I've only just started
doing OOP in PHP... but it stands to reason that I likely will, and soon.
Navigation:
[Reply to this message]
|