V
v4vijayakumar
Why following statement is not a "forward declaration"? 
class namespace1::namespace2::class1;
class namespace1::namespace2::class1;
v4vijayakumar said:Why following statement is not a "forward declaration"?
class namespace1::namespace2::class1;
Why following statement is not a "forward declaration"?
class namespace1::namespace2::class1;
available, your code will be perfectly valid.
If the namespace declaration
namespace x
{
namespace y
{
}
}
class x::y::c;
Errors
error C2039: 'c' : is not a member of 'x::y'
error C2365: 'x' : redefinition; previous definition was 'namespace'
error C2079: 'c' uses undefined class 'x'
john
If the namespace declaration
namespace x
{
namespace y
{
}
}
class x::y::c;
Errors
error C2039: 'c' : is not a member of 'x::y'
error C2365: 'x' : redefinition; previous definition was 'namespace'
error C2079: 'c' uses undefined class 'x'
john
This isn't a forward declaration, John's was.Sarath said:Ooops forgot the post the sample code
namespace x
{
namespace y
{
class CTest
{
};
}
}
class x::y::CTest;
This is it
This isn't a forward declaration, John's was.
I see, but the topic was forward declarations, for which the syntaxSarath said:I was talking about the validity of the statement. Sorry if poorly
communicated.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.