How can I cast a class to another type? Example:
class Point
{
Point(int X, int Y);
};
Point A(10, 10);
POINT P = (POINT)A;
A = (Point)P;
//I've tried:
Point::Point(POINT P) : X(P.x), Y(P.y), Color(0) {} //Constructor.
Point& Point::operator ()(POINT P)
{
if (X != P.x && Y != P.y)
{
X = P.x;
Y = P.y;
Color = 0;
}
return *this;
}
How do I go the other way around? I've tried doing the reverse the exact same way but it doesn't work. Did I do the above correctly?