If I have a nested class like so:
class MyClass
{
class NestedClass
{
public:
// nested class members AND definitions here
};
// main class members here
};
Currently, the definitions of MyClass
are in the CPP
file but the definitions for NestedClass
are in the header file, that is, I cannot declare the functions/constructors in the CPP
file.
So my question is, how do I define the functions of NestedClass
in the cpp file? If I cannot, what is the reason (and if this is the case, I have a vague idea of why this happens but I would like a good explanation)? What about structures?