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 

Definition and Declaration (Definitions)

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Patchwork
Guest





PostPosted: Sat Feb 28, 2004 12:08 pm    Post subject: Definition and Declaration (Definitions) Reply with quote



Hi,

I guess you have all heard this one a thousand times before but until today,
I thought I knew the difference between the meaning of 'definition' and
'declaration' in C++. Please help me by letting me know which comments are
true and which are not:

// This is a class declaration
class CMyClass;

// This is a class definition
class CMyClass : public CMyBaseClass
{
// This is a member function declaration inside a class definition
void MemberFunction1();

// This is a member function definition inside a class definition
void MemberFunction2() {cout << "Hi";}

// This is a definition
float m_MyFloat;
};

// This is a function declaration
void Function1();

// This is a function definition
void Function2()
{
// This is a definition
int MyInt;

// This is a definition
CMyClass MyClass(4);
}

Many many thanks,
Lucy



[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) 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.