I am currently working on an object, and writing a class(Trangle) that extends another class of an object. I am stuck on inputting an eaquals method in the ain object method. Basically i dont know where to put it. The code i am supposed to use is My enitre code is quite long, but here it is.
this is the methed that i need object1.equals(object2) to reference to.
Hi, I only had a quick look thru the whole code, but I think you can put it anywhere in Triangle class. Also, I think the signature of equals method should be boolean equals(Object a), and not boolean equals(Triangle t) to properly over-ride the equals method in Object. Then in the method you can do a check like if (!(a instanceof T)) return false hope that helps!
You might want to consider two triangle objects "equal" if they both have the same color, are both filled or unfilled, and have the same verticies. This is in lieu of only considering objects equal if they are the exact same object.
Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>
Joined: Dec 08, 2003
Thanks a lot guys. I fully understand the problem now. And again, i think all of tyou very much. Ryan Vines