help needed

I have a class ,say, A declared in A.h
I have another class, say , B declared in B.h
Now i need a pointer to class A in class B
and a pointer to class B in class A
so i included A.h in B.h
and also B.h in A.h
I used #ifndef A_H
#define A_H

but it is giving errors:redefinition of `class A',
redefinition of 'class B'
Any help would be apprecciated. Many thanks
closed account (z05DSL3A)
If you only need to have a pointer to the other class then just declare the class needed. So in A.h just have a line 'class B;' before class A is defined and in B.h have a line 'class A;' before class B is defined.

Hope this helps.
Topic archived. No new replies allowed.