Reply to Re: Using a Resource as a Class Property

Your name:

Reply:


Posted by Jerry Stuckle on 07/23/07 16:15

Toby A Inkster wrote:
> Sanders Kaufman wrote:
>
>> 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")
>
> You understand differently to me then. This is called "multiple
> inheritance" and very few OO languages support it.
>
> You can inherit from more than one class like this:
>
> class A {}
> class B extends A {}
> class C extends B {} /* and thus A */
>
> but not like this:
>
> class A {}
> class B {}
> class C extends A, B {}
>
> If you use interfaces, you can write a class that implements multiple
> interfaces:
>
> interface A {}
> interface B {}
> class A implements A, B {}
>
> and that is fine. (Same story with Java.)
>

Very true. And it can be good or bad. In some ways I miss multiple
inheritance, but in other ways, not. I've seen it misused more than
properly used.

For instance, I taught a C++ course (not written by me) at one time
which used the example "toy car" as inheriting from both toy and car.
Now I agree it is a toy - but it is not a car in the same sense a real
car is. But it was an example I had to teach :-(.

I've seen very few true implementations of multiple inheritance, and
those I have seen have basically been implementations of a base class
plus one or more interfaces.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация