For example i have a class name Point.
class Point{
protected:
int x, y;
public:
void setX(int);
void setY(int)
int getX();
int getY();
}
void Point::setX(int newX)
{
x = newX;
}
There is setX, getX, setY, getY inside.
How do I start a vector array with this? so that I can use setX, getX and all?
You just have to declare a
I recommend you add a constructor to your class that takes as an argument the point’s coordinates:
Then you can just add points to your vector using
and once your vector is filled, you can get the coordinates of the points inside using your functions. For example: