Very Confused on Page 33

From: eBob.com (eBob.com_at_totallybogus.com)
Date: 01/29/05


Date: Sat, 29 Jan 2005 10:53:59 -0500

I am only on page 33 of Bruce Eckel's "Thinking in Java" and I am so
confused by one point that I can go no further without getting this
straightened out. On page 33 Bruce is explaining inheritance. The text
which confuses me is " ... all the messages you can send to objects of the
base class you can also send to objects of the derived class. Since we know
the type of a class by the messages we can send to it, this means that THE
DERIVED CLASS IS THE SAME TYPE AS THE BASE CLASS. ..." (emphasis added)

I am not totally unfamiliar with OOP and I understand that all messages
which can be sent to objects of a base class can also be sent to objects of
the derived class. BUT, I would think that, in general, the inverse is not
true. Without getting into what the meaning of is is, am I supposed to
understand that the derived class is the same type as the base class, but
the base class is not the same type as the derived class?

But even if that would resolve the confusion which I have explained so far,
what about "Overriding base-class functionality" - the topic which is
comming up at the bottom of the page. Even assuming that "the derived class
is the same type as the base class" is not meant to be a symmetric
statement, is it true even though the derived class might have overridden
functions? I would think that the compiler would need to be able to
distinguish between objects of the base class and objects of the derived
class. How would it do that if they both are of the same type?

If anyone can help get me past this confusion I'd appreciate it.

Thanks, Bob



Relevant Pages

  • ( Very Confused on Page 33) Thanks! to the Many Responders ...
    ... > base class you can also send to objects of the derived class. ... > If anyone can help get me past this confusion I'd appreciate it. ... > Thanks, Bob ...
    (comp.lang.java.help)
  • Re: Very Confused on Page 33
    ... > base class you can also send to objects of the derived class. ... since many animals don't like to be milked. ... > If anyone can help get me past this confusion I'd appreciate it. ...
    (comp.lang.java.help)
  • Re: Application.Run() problem
    ... still am very much confused about the paint event handler. ... It most obviously should be the derived class, ... It seems that you're not understanding how inheritance works. ... which ensures that the base class uses the same ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Very Confused on Page 33
    ... On page 33 Bruce is explaining inheritance. ... > base class you can also send to objects of the derived class. ... The programmatic difference enables the subclass ...
    (comp.lang.java.help)
  • Re: attribute or subclass
    ... With inheritance the derived class code ... reference in place of the base class reference. ...
    (comp.object)