How to correctly forward declare classes ?. If I try this it won’t compile:
#include<iostream>
#include<conio.h>
class B ;
class A
{
public:
B returnB()
{
return B() ;
}
} ;
class B
{
public:
A returnA()
{
return A() ;
}
} ;
int main(void)
{
getch() ;
return 0 ;
}
Sometimes there are scenarios where you must define your functions outside of the class:
Usually the definition (implementation) goes inside a separate *.cpp file. If it is in a header, then it has to be
inline.