From: RedGrittyBrick on

alexandre_paterson(a)yahoo.fr wrote:
> On Nov 4, 11:18 pm, markspace <nos...(a)nowhere.com> wrote:
> ...
>> Here's a good tutorial:
>>
>> http://www.javapassion.com/javaintro/
>
> Well... To me anyone who defines inheritance as
> "code reuse" deserves to be shot (the author of
> that tutorial sure does)

I don't interpret his statement that way:

"Inheritance is one of the most important OO concept along with
encapsulation and polymorphism. Basically it allows reuse of the code
since a sub-class (child class) can readily use the properties and
methods defined in the super class (parent class)."

He isn't *defining* inheritance, he's describing, for those new to Java
and to OO, something inheritance allows. It's a necessarily simplistic
statement that is followed by a reference to the Sun tutorial on
inheritance in Java.


> and I would be very cautious about writing made by such a person :(

His writings are often recommended here by people whose opinions I have
come to respect.


> Objective-C programmers are having a good laugh about
> inheritance being about "code reuse" ;)

I don't remember any occasion when I have been convinced of something by
the reported laughter of the misinformed. Rather the opposite effect
pertains.


It seems to me the top two hits for "objective-c inheritance" don't
really do much better:

"Inheritance in Objective-C is similar to Java. When you extend your
super class (of which you can only have one parent) you can override the
methods of your super class by simply putting the new implementations in
the child classes implementation."

"Objective-C enables programmer to inherit common methods and properties
from other class, known as inheritance."



--
RGB