NNPoint
class NNPoint
{
public:
NNPoint();
NNPoint(uint32_t x, uint32_t y);
public:
void setX(uint32_t x);
uint32_t getX();
void setY(uint32_t y);
uint32_t getY();
public:
virtual std::string getType();
virtual std::string toString();
virtual std::shared_ptr<NNPoint> clone(bool deep);
};
Introduction to the class
Represents a point in a 2D space with integer coordinates.
This class provides methods for setting and getting the x and y coordinates, as well as virtual methods for retrieving the type of point and generating a string representation. It also includes a clone method for creating a copy of the point, with an option for deep copying (though in this simple class, deep and shallow copying are the same).
Introduction to the Class's Methods
NNPoint()
brief: Default constructor. Initializes the point at the origin (0, 0).
NNPoint(uint32_t x, uint32_t y)
brief: Parameterized constructor. Initializes the point with the specified x and y coordinates.
param
x: The x coordinate of the point.
y: The y coordinate of the point.
void setX(uint32_t x)
brief: Sets the x coordinate of the point.
param
x: The new x coordinate.
uint32_t getX()
brief: Gets the x coordinate of the point.
return uint32_t: The x coordinate of the point.
void setY(uint32_t y)
brief: Sets the y coordinate of the point.
param
y: The new y coordinate.
uint32_t getY()
brief: Gets the y coordinate of the point.
return uint32_t: The y coordinate of the point.
std::string getType()
brief: Gets the type of the point.
return string: A string representing the type of the point.
std::string toString()
brief: Generates a string representation of the point.
return string: A string representing the point.
std::shared_ptr<NNPoint> clone(bool deep)
brief: Creates a copy of the point. This method provides an option for deep copying, though in this simple class deep and shallow copying are equivalent.
param
deep: A boolean indicating whether to perform a deep copy. In this class, it has no effect.
return shared_ptr<NNPoint>: A shared pointer to a copy of the point.