> > Yes it does. Under the covers you can think of a Dalmatian record as
> > a Dog record with a few fields tacked on the end. The Dog code just
> > uses the dog fields, but passes the address of the complete beast
> > around. When it gets past to something that understands Dalmatian
> > code it will use the Dalmatian fields.
That's not polymorphism at all. If you pass the object to something
that uses a Dalmation, you would have to cast the object. Polymorphism
says that if you call a method of that object, and Dalmation has
overridden (i.e., provided a specialized version of) that method, then
the specialized version of the method will be called... and will already
know that it's a Dalmation.
In Java, polymorphism never has anything to do with passing an object to
some other it of code. It only applies to doing something to the object
itself.
> Thanks, so that means addRecord can add the record to the data base just
> fine and then when I use getRecord from the ProductDB
Not necessarily. Roedy is talking about uses of the object INSIDE the
language. Polymorphism does not solve the problem of storing an object
in an external database. (Reflection, on the other hand, might help to
solve that problem of storing the object to an external database... but
even reflection is generally supplemented by some kind of annotations or
customizable O/R mapping configuration file when solving that problem in
the real world.)
> I just have to
> determine with getClass from Object what class it is and I can cast it as a
> Book or as Software?
You can do this, but that's not polymorphism either. That's runtime
type identification, which is a different matter. Typically, you'd do
it with the instanceof keyword, rather than with getClass().
Polymorphism says that if you call a method of that object that's been
overridden by Software, then the overriding code will get called (and
THAT code will implicitly know that it's working on an object of class
Software, since that's where it's defined).

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation