Well, do what you gotta do. Now that I understand the prof's requirements better, what's your question? I think if you create the class hierarchy that you've described, all should fall into place....
Type: Posts; User: GregBrannon
Well, do what you gotta do. Now that I understand the prof's requirements better, what's your question? I think if you create the class hierarchy that you've described, all should fall into place....
Square extends Point. Didn't see that coming (Edit: even though you stated it plainly enough - sorry I missed that), but now I understand why the Square() constructor requires 3 parameters.
I don't have the 2 weeks of experience to rely on, but based on what you've said, either Shape has the instance variables (x, y) that all subclasses inherit, or Shape contains an instance variable...
Still a bit confused, but if every Shape has an (x, y) - a point that defines where they are in space - then those variables are part of the super class, Shape. Square doesn't inherit them from...
I don't understand exactly what your problem is, but don't create the shape until the data has been gathered to create it. For example, "new Square()" should not be the first statement of the case...