class hierarchy problem
in
Programming Questions
•
1 year ago
Hi everyone,
i want to create an object that creates 4 objects of another class.
problem is, that i don't seem to have access to that secondary class
("Cannot find anything named "Point")
i know i could make the Point class a nested class to solve this, but this would mess up large parts of my other code.
is there any way to do it otherwise?
thank you!
here is my approach:
i want to create an object that creates 4 objects of another class.
problem is, that i don't seem to have access to that secondary class
("Cannot find anything named "Point")
i know i could make the Point class a nested class to solve this, but this would mess up large parts of my other code.
is there any way to do it otherwise?
thank you!
here is my approach:
- class QuadPoint
{
Point[] p = Point[4];
QuadPoint( float getX1, float getY1, float getZ1, float getW, float getH, float getD )
{
p[0] = new Point( getX1, getY1, getZ1 );
p[1] = new Point( getX1, getY1 + getH, getZ1 + getD );
p[2] = new Point( getX1 + getW, getY1 + getH, getZ1 + getD );
p[3] = new Point( getX1 + getW, getY1, getZ1 );
}
}
class Point
{
int x,y,z;
Point( float getX, float getY, float getZ )
{
x = round(getX);
y = round(getY);
z = round(getZ);
}
}
1