Question about classes in C++

Status
Not open for further replies.

Lucifre

Full Member level 2
Joined
Jul 5, 2005
Messages
125
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,296
Location
Detroit MI
Activity points
2,389
My book states that class methods must always be defined in a source file.
is it possible to define a class and its method definitions in a single header file?
If i am not wrong string is a class, and u use only a single header file to use it.
 

Lucifre said:
My book states that class methods must always be defined in a source file.
is it possible to define a class and its method definitions in a single header file?
If i am not wrong string is a class, and u use only a single header file to use it.
Yes! This is permissible as long as you only include the header file once in your project. If you include it more than once you will get Duplicate Definition errors.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…