Original Post
ok ill try to make this as easy to understand as possible
if i have a class defined as so
public class triangle implements Comparable
{
public triangle();
.
.
.
}
and then another class like so
public class Square
{
public Comparable[] mySquare;
public Square(int sides)
{
mySquare = new Comparable[sides];
for (int x=0;x<sides;x++)
mySquare[x]= new triangle();
}
.
.
.
}
alright
now how do i go about
calling an instance of the square class in a main file
and have that object use what ever methods are in the triangle class
for example
Square s1 = new Square(4);
now if i was to do something like this
where area is a method in the triangle class it doesnt work
but i dont know if can make it so that u could
s1.area();
|