Q Does anyone know how to return A::B without moving A to top?
A That is not possible.
Forward declaration of A
does not give any details of what's inside the A
. Hence, A::B
is not a known type in class C
.
In order to use A::B
in class C
, you have to put the complete definition of class A
before the definition of class C
starts.