Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Implementation in header or cpp file?

0 views
Skip to first unread message

Oliver Wulff

unread,
Nov 3, 1999, 3:00:00 AM11/3/99
to
Hi

Can anybody explain me the difference between implementing a class in the
header or in the cpp file?

Thanks
Oliver

Torsten Müller

unread,
Nov 3, 1999, 3:00:00 AM11/3/99
to
Very simple: definition of public classes should be noted in header files,
implementation generally in source files. If you have private classes which
are not designated to be used from elsewhere put also the definition into
the source file. A header is not needed then.

Inline methods and methods of class templates are normally also found in
headers. This is an exception because the code of these methods must be
known whereever the method is called.

Oliver Wulff <oliver...@zurich.com> schrieb in im Newsbeitrag:
unucoZfJ$GA.253@cppssbbsa05...

Big Rich

unread,
Nov 4, 1999, 3:00:00 AM11/4/99
to

> Hi
>
> Can anybody explain me the difference between implementing a class in
the
> header or in the cpp file?
>

If you define a class method function implimentation in the header file
(actually in the body of a class definition - which should be in the
header file) it automatically becomes an inline function.


Sent via Deja.com http://www.deja.com/
Before you buy.

0 new messages