Dan D'Apice wrote:OK, so that's where the override comes in?
I'm going to give it a try and see what other errors I get...
That means other classes need to “know about” the book class. Not at all object‑oriented programming; the book class should take care of itself. If you change the implementation of the book class, (or even worse, its public interface), such a method will be broken. What if you add an author field to the book class later?Corrie L Sherone wrote:Not to discourage you from learning about overriding
but there is more than one way to skin a cat ("ouch"!). Do not forget your Book class has all those perfectly good methods for obtaining the name, price etc. All you need is a Book object from your list.
Dan D'Apice wrote:So, after some time I've gotten a little further. I love Java...NOT!!!...what a PITA!!
I feel like I've been pushed into the deep end of the pool without being taught how to swim....now what am I missing?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Campbell Ritchie wrote:That means other classes need to “know about” the book class. Not at all object‑oriented programming; the book class should take care of itself. If you change the implementation of the book class, (or even worse, its public interface), such a method will be broken. What if you add an author field to the book class later?
Overriding (and polymorphism) is the way to go.
Dan D'Apice wrote:There is another requirement that is due Sunday, but right now I need to de-tox from coding for a bit. I am not cut out for this. 3 more weeks left to class and I am humbly bowing out. Thanks again to everyone for your awesome suggestions and support! You all have what it takes...
Stinging nettles are edible. But I really want to see you try to eat this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|