You need to provide more details and at least make some attempt at writing the code so folks here can help.
The brute force method would be to write a sameArea() function for each pair of parameter types (i.e., Rectangle, Rectangle Rectangle, Circle, ...etc). Function overriding would ensure that the correct method is called when you invoke sameArea based on the arguments to the method invocation.
I assume you have learnt Polymorphism and Inheritance? If so, try to figure out how Polymorphism could help you in this situation. What do Rectangle, Circle and Square have in common?
PS - Your method declaration is very wrong. Where are your brackets and parameters for the method? What do your Circle/Rectangle classes look like? Have you written any methods for those classes?
The object-oriented way to do it is to create an interface which includes a way to get its area. The get method returning a double does not allow anybody to alter the object, so you can make the object immutable if you so wish. Make your circle square and triangle classes implement that interface, then you can apply it to a method taking two objects of that interface as parameters. You can easily change my example to fit your requirements.
Joined: Jan 18, 2012
Campbell, I think you meant to override the getArea() function in the child classes. You named the methods getSize().