Java ---> C++ Project
Ok - So I was working on this program in Java. The purpose is to be able to
create an instance of class "Shape", which extends "FilledGraphical", which
extends class "Graphical Component". When you create a new instance, be it a
type of shape - whatever, you give it the following attributes:
The type is defined when you declare it, por ejemplo:
public Shape myShape = new Isoceles(15. ,12. );
There are class files for Isoceles, Right, Circle, Rectangle, etc (look at
the code if please). The methods for retrieving area and perimeter are
deployed using the technique of permutation. So with the Isoceles defined,
I can now go:
I can now go myShape.getPerimeter() , and it would use the formula for the perimeter
of an Isoceles triangle to give me a return value. (The formula, btw, is
Math.sqrt(base* base + height * height) + base + height .) If I wanted the
area, I would pass the values for the base and the height to the superclass,
which is Triangle, and it uses that formula. Setting color and location is
done by myShape.setColor(Color.black), or whatever color (imported java.awt),
and myShape.setLocation() or myShape.move(). Now that I have the basics
of what the program does, I was wondering if somebody out there could take
the time to transpose the code to C++, so I could use it as a reference
while learning the language. If would be interested in doing so, they can
submit the program to firstname.lastname@example.org.
Any help would be swell!
"Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like. My crime is that of outsmarting you, something that you will never forgive me for."