C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

forward declaration

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
fa
Guest





PostPosted: Mon Jul 28, 2003 4:55 pm    Post subject: forward declaration Reply with quote



hi all,
following the standard what is allowed in forward declarations
beetween:


1) class a_class; //forward declaration
class another_class
{
a_class object;


};

2) class a_class
class another_class
{
a_class* object
}

3) class a_class; //forward declaration
class another_class : public a_class
{


};


it seems on my compiler that just the 2nd one does compile.
more, what the standard says about the standard library? at my
knolewdge with members of the standard librery forward declarations
are not permitted, isn'it?
thanks

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]

Back to top
Richard Smith
Guest





PostPosted: Mon Jul 28, 2003 7:08 pm    Post subject: Re: forward declaration Reply with quote



fa wrote:

Quote:
1) class a_class; //forward declaration
class another_class
{
a_class object;
};

This is not legal. All members must be complete.

Quote:
2) class a_class
class another_class
{
a_class* object
}

This is perfectly OK.

Quote:
3) class a_class; //forward declaration
class another_class : public a_class
{
};

Again, this is not legal. Base classes must also be
complete.

Quote:
what the standard says about the standard library? at my
knolewdge with members of the standard librery forward declarations
are not permitted, isn'it?

I'm not sure I understand the question. If you're asking
whether you are allowed to forward declare classes that are
defined in the standard library, then the answer is no.

--
Richard Smith

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]


Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.