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

Definition on .cpp or .h ?

0 views
Skip to first unread message

CPP beginner

unread,
May 27, 2009, 6:26:41 PM5/27/09
to
Is it better to put definition on headers or on cpp ?
Why ?

Does it increase size of object ?

Template class definitions must always be on .h ?

What does it cost ?

Thank you

Mateusz Loskot

unread,
May 27, 2009, 7:47:06 PM5/27/09
to
CPP beginner wrote:
> Is it better to put definition on headers or on cpp ?
> Why ?

Have you tried to find answer in the archives first?

http://groups.google.com/group/comp.lang.c++/browse_thread/thread/1a4b427d09b3eb77/

> Does it increase size of object ?

It may increase size.

> Template class definitions must always be on .h ?

It does not, but it's very/most common approach.

http://www.parashift.com/c++-faq-lite/templates.html#faq-35.14

> What does it cost ?

http://www.parashift.com/c++-faq-lite/inline-functions.html
http://www.parashift.com/c++-faq-lite/templates.html#faq-35.10

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org

0 new messages