Assorted questions ...

Kris Wong wongk at seapine.com
Tue Jun 19 12:18:14 UTC 2007


> class Foo
> {
> public:
>     Bar getBar();
> };
>
> I really didn't understand this. If foo.h contains a forward
declaration
> of Bar, other classes including foo.h will be successfully compiled,
am
> I wrong ? Any troubles would occur at linking-time. Why the order of
> includes would make difference ?

In this particular instance, you are wrong.  Forward declarations only
work for references or pointers.  A source file that #include's foo.h
cannot compile w/o first #include'ing bar.h, which is bad form.

Kris Wong




More information about the KDevelop-devel mailing list