 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Patchwork Guest
|
Posted: Sat Feb 28, 2004 12:08 pm Post subject: Definition and Declaration (Definitions) |
|
|
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 |
|
 |
|
|
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
|
|