Can I declare a nested class but define afterwords?
I am getting error on doing this. Please suggest a way out if we can do this.Code:class a
{
public:
class b;
};
class a::b
{
};
Printable View
Can I declare a nested class but define afterwords?
I am getting error on doing this. Please suggest a way out if we can do this.Code:class a
{
public:
class b;
};
class a::b
{
};
It is possible and part of the typical PIMPL pattern implementation.
What error do you get?
its legal but some compilers dont like it.
error reads
i am compiling it on turbo c++Code:multiple declaration of a::b
sorry, i am not able to find it on faq
What version of Turbo C++?
I am using turbo c/c++ 3.0
error reads
Code:
multiple declaration of a::b
i am compiling it on turbo c++3.0
That's a horribly outdated compiler, known not to support any kind of nested classes.