That's what I was afraid of....
I'm having trouble wrapping my thoughts around the concept of having to take everything related to a particular class/object, extract it from the class and basically pimp it out to some other class and an accompanying interface...
If I had some super class "Duck", and then had several child classes that represented specific ducks, "MallardDuck, CartoonDuck, DecoyDuck, RubberDuck"etc etc, then everything that defines the uniqueness of each specific duck (the things not inherited from "Duck") would be extracted and given to some other class that implements some interface. So, in the end, these specific child classes are basically stripped bare.
And so, I'm finding it difficult to even see the point in having the child classes to begin with. It would seem that it would just be better to have the super class "Duck" and then have several behavior classes (that do not extend Duck) to represent a Duck. Then each instance of Duck would be named with a specific duck name in order to pseudo represent an actual specific duck.
In other words, in my confused state, it would seem that inheritance is pointless !
An example would be a class that simply prints a
word like "Java". Does that mean I need to have a class that handles a J, another to handle the a's and then yet another to handle the v? And of course, I'm sure I would need an interface "letters" to be implemented by yet another class "words"...... it just seems like everything has to be broken down into it's most simplest form, regardless of how many sub-components it generates and then reconstructed into some intricate and complicated entity that in the end will still do no more than print the word "Java"......
I'm really bummed at the moment : (
The concept of composition, I believe, is what I'm struggling to integrate into my inheritance-centric thoughts.....make sense ?
I would love to have someone that understands my jibberish respond with a clearer description of how inheritance, composition and polymorphism each find their respective places in the Java Universe...
Thanks