> Sorry I haven´t read your message carefully. The problem is that the
> compiler does´n´t know TestClass2 at this time.
> You have to tell him that this class will be decalred later. Just insert
> class TestClass2; before declaration of TestClass1.
> Like this:
wrote in message
news:1164294605.448111.29330@h54g2000cwb.googlegroups.com...
>Hi again,
>
[quoted text clipped - 3 lines]
>> class TestClass2; before declaration of TestClass1.
>> Like this:
That will work until you actually try to start using the class, then you'll
also
want to #include both header files in each implementation (.cpp) file.
>Thanks, that did the trick! I thought forward declarations were part of
>the past, but apparently not (o:
Not at all. It's just that several increasingly popular languages (Java,
C#) use multi-pass compilation and don't have forward declarations. They
pay a price in complexity, you could never get C++'s template behavior
w.r.t. local specializations in that way. Also, it's useful for minimal
rebuild -- C# must recompile every single file after each change, while C++
needn't.
>Best,
>Michael.