Group: comp.lang.c++
From: "ibm@svpal.org"
Date: Monday, April 07, 2008 3:42 PM
Subject: Class and Instance having same name

Consider the following code snippet:

...
class XXXX
{
public:
XXXX()
{
cout << " XXXX Constructor " << endl;
};

int i;
};


class YYYY
{
public:
YYYY()
{
cout << " YYYY Constructor " << endl;
};

int i;
class XXXX XXXX; // compiles ( g++ )
// XXXX XXXX; // does not compile
};
...

Note the declaration/definition of an instance XXXX of class XXXX in
class YYYY.
It is my contention ( and g++ seems to agree ) that such a construct
ought to be in error.
VIsual C++ and another as yet unknown compiler ( the problem occurs in
some third party code ) seem to have no trouble with the commented out
code ( XXXX XXXX; ).
What I'm looking for is material to wrap around a blunt object which I
may then
use to correct the offending third party if the fact the situation is
as I suspect.
Thanx.

IBM