SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Originally posted by Andre Brito:
I've grab my Deitel's book and looked at this excescise.
So, I think that he mentioned that Quadrilatero = 4 sides shapes. That's the reason that I've made Trapezium and "kites" subclasses from Quadrilatero. And kites have 2 values (the D and d), so, I guess it could stay subclass from Quadrilatero, don't you think the same? I'll just have to override the method calculateArea(). The problem is with trapezium...
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Originally posted by Andre Brito:
After think a little and talk with a friend of my (from here, Brazil), I made the class diagram:
http://img219.imageshack.us/my.php?image=capturadatelaxm7.png
And it'll stay this way because I believe that it's a good shape, don't you think? Please, if you have any ideas, just put it down here! Hehe.
BTW, class Quadrilatero is abstract. The method calculateArea() is abstract and that way, trapezoid has its method and Retangulo has its method.
One thing that I'm not understanding is: what's the advantage of my superclass have 1 abstract method? Like... if I can override it, wouldn't be better if I had to write only 1 more method (the one that would override) instead I had to write 1 assignature and 2 methods different?
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Originally posted by Andre Brito:
but how can I call the method that is not implemented? When do I use abstract method?
Why I can't keep the concrete and override the new one when this is the easier way to do?
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
30 seconds to difuse a loaf of bread ... here, use this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|