Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c++ Subject: Re: .h and .cpp Date: Wed, 30 Nov 2011 09:23:01 +1300 Lines: 36 Message-ID: <9jkt95F4d0U34@mid.individual.net> References: <4ed48fde$0$2782$7b1e8fa0@news.nbl.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net NqKBhM7FpJOWLyXBjc0/Kg08EHQaNZEGonC5fq8OxNUrzTljJe Cancel-Lock: sha1:0Yxb4iTH+PEif3+s8vyXVnkccqA= User-Agent: Mozilla/5.0 (X11; SunOS i86pc; rv:6.0.2) Gecko/20111003 Thunderbird/6.0.2 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:11960 On 11/30/11 09:15 AM, Christopher wrote: > On Nov 29, 1:55 am, Juha Nieminen wrote: >>> 1b) A .h file should never contain class implementation (except for >>> inline functions or methods) >> >> That's a null statement. If a header file contains implementations, >> they will be inline by necessity (else you'll get linker errors if the >> header is included more than once), so that rule isn't really saying >> anything. > > > I've seen this claim in several of the replies. I made a minimal > example that compiles and links in Visual Studio 2008 SP1 (what they > use at work). > > --ClassA.h--- > #ifndef CLASSA_H > #define CLASSA_H > > #include > > class A > { > public: > > A() > : > m_x(0) > { > std::cout<< "Contructor"<< std::endl; > } This is an inline function. -- Ian Collins