Mail Archives: djgpp/1999/10/25/12:31:07
In article <3812BDDA DOT E709C2E1 AT hjc DOT edu DOT sg> you wrote:
> I defined two classes call "cPoint" and "cRect" in a header
> file(crect.h). I also implemented them in the same file because I wanted
> to utilise the function inlining...
You didn't "utilise the inlining" correctly, and that's exactly your
problem.
[...]
> class TInline {
> public:
> TInline();
> ~TInline();
> };
> TInline::TInline() { /* empty */ }
> TInline::~TInline() { /* empty */ }
These two method implementations are *not* inlined. For that, you ought
to have put them *into* the class definition, like this:
class TInline {
public:
TInline() { /* empty */ };
~TInline() { /* empty */ };
};
The rule of thumb is that you shouldn't generally have standalone
method implementations in a header file. Only inline methods
(implementation inside the class declaration) should be in there.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -