C
Chameleon
How can I do this:
struct Vector2D
{
Vector2D() : x(0), y(0) {}
explicit Vector2D(Vector3D &v) : x(v.x), y(v.y) {}
double x, y;
};
struct Vector3D
{
Vector3D() : x(0), y(0), z(0) {}
Vector3D(Vector2D &v) : x(v.x), y(v.y), z(0) {}
double x, y, z;
};
struct Vector2D
{
Vector2D() : x(0), y(0) {}
explicit Vector2D(Vector3D &v) : x(v.x), y(v.y) {}
double x, y;
};
struct Vector3D
{
Vector3D() : x(0), y(0), z(0) {}
Vector3D(Vector2D &v) : x(v.x), y(v.y), z(0) {}
double x, y, z;
};