Pete Becker
10/30/2008 8:50:00 PM
On 2008-10-30 16:44:30 -0400, Pete Becker <pete@versatilecoding.com> said:
> On 2008-10-30 15:27:55 -0400, Mosfet <mosfet@anonymous.org> said:
>
>> Hi,
>>
>> I have two classes, let's call them class A and class B with mutual
>> dependencies as shown below and where implementation is inside .h (no
>> cpp)
>>
>>
>> #include "classB.h"
>> class A
>> {
>>
>> };
>>
>> #include "classA.h"
>> class B
>> {
>> };
Whoops, the preceding won't, of course, work. I must be having a bad day.
>>
>> So to solve this I am using forward declaration in class B and I had
>> to mo ve implementation in a .cpp
>>
>> class A;
>> class B
>> {
>> ...
>> };
>>
>>
>> IS there another way to solve this and to keep implementation only in .h ?
>
> Everything you've written should work just fine, modulo the "..." in
> the second definition of class B.. The problem must be in the code that
> you didn't include.
--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)