[nycphp-talk] Multi-Inheritance in PHP 5
Hans Zaunere
hans at nyphp.com
Sat Oct 9 21:11:48 EDT 2004
> http://www.artima.com/intv/abcs.html
Thanks for the link, and great discussion guys... interesting stuff.
Not being a huge OOP fan myself, I haven't dived too deeply into this
stuff. After cursory reading about these topics over the years,
interfaces were always pitched as the elegant answer to multiple
inheritance.
However, in both the Java and PHP worlds, I'm tending to think there is
a common misnomer about interfaces and multiple inheritance. When
defining multiple inheritance to mean inheriting functionality, it
simply doesn't exist, and interfaces don't help.
This is a good link:
http://www.javaworld.com/javaworld/jw-09-2001/jw-0907-java101.html
In the "The power of the interface" subsection, the author states:
"Interfaces don't just provide a workaround to Java's lack of support
for multiple implementation inheritance."
This just isn't true, to me. They aren't a workaround. Without
inheriting functionality (implementation), they are a completely
different animal, providing only syntactic inheritance, as stated in the
next sentence:
"Interfaces factor out commonality across diverse class hierarchies,
resulting in compact and understandable source code."
It's all about the source code, not the functionality, to put it
bluntly.
So, while interfaces certainly have their place, and I know the
complications that true (C++) multiple inheritance can add, something in
the middle would be nice, in both Java and PHP.
H
More information about the talk
mailing list