Well I wouldn't necessarily make the variables public, rather keep them private and use get and set methods to provide access to them. Protected would provide access to them in the triangle class...
Type: Posts; User: jps
Well I wouldn't necessarily make the variables public, rather keep them private and use get and set methods to provide access to them. Protected would provide access to them in the triangle class...
When you say:
super(b,h) you store your base and height in your super(rectangle) class. Rather than using new variables in the extended(triangle) class, you can refer to those in the super. Base...
Are you storing the same value in 2 different places? Once witin (super)rectangle's variables and once again within the triangle? Certianly don't need to keep the same data twice... Should be a way...
The reason you extended rectangle rather than just using it, is because some things are different. The important concept is to reuse what you can, and modify for your specific case in the new class....
Ok so geometry was longer ago than I can recall.
So a correction to my last post.
As far as the triangle, it should extend the rectangle class. Now that pbrockway2 pointed out my mistake, and i...
I want to add to this a bit more as it seems to me you have missed a crucial (and possibly the main) point of this assignment, as this is a very crucial concept in object oriented programming.
...
Actually if you consider the relationship among the limited shapes in the assignment, there is a clear answer.
All 3 shapes can have the area volume and perimeter calculated by knowing the length of...