Why c++ is not allowing me to forward declare class inside namespace?
What C++ does not allow is to have a function such as
Car abc()
{
return Car();
}
without class Car
's definition. This is needed because a) the size of a Car
object is required, and b) there is a call to the default constructor of the class. Without the class definition, there is no way to know whether the constructor exists or not.