Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Class & Instanc...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 9476 of 10104
Post > Topic >>

Class & Instance thereof having same Name.

by "ibm@[EMAIL PROTECTED] " <ibm@[EMAIL PROTECTED] > Apr 8, 2008 at 04:54 PM

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 admonish the offending third party if in fact the
situation is
as I suspect.
Thanx.

IBM

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 3 Posts in Topic:
Class & Instance thereof having same Name.
"ibm@[EMAIL PROTECTE  2008-04-08 16:54:22 
Re: Class & Instance thereof having same Name.
Greg Herlihy <greghe@[  2008-04-09 13:19:44 
Re: Class & Instance thereof having same Name.
Pavel Minaev <int19h@[  2008-04-09 13:43:23 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Oct 15 22:33:56 CDT 2008.