I am trying to create some conversion functions for two classes by overloading the ‘=’ operator. Here is some code:
class Vertex {
public:
int X, Y;
// .......
Vertex& operator= (const VertexF &); // ERROR, VertexF is not declared
};
class VertexF {
public:
float X, Y;
// ......
VertexF& operator= (const Vertex &);
};
How can I make this work?
Use forward declaration: