1

I want to have a struct in one class, like this:

namespace C {
    class H
    {
        struct A
        {
            .....
        };
        //other members
    };

    class R {
      //R's members
    };
}

and in another header file just using a name d.h, I need to declare these classes, for example:

namespace C
{
   class H;
   class R;
}

Now my problem is, how to declare struct A in d.h file?

can I use

namespace C
{
   class H {struct A;}
   class R;
}
yewei
  • 241
  • 2
  • 9
  • You shouldn't have to. `A` is `C::H::A`. Folk who only know a forward definition of `H` probably shouldn't know about `H::A`. If they need to know, why put it in `R`? `R::A` will not be the same type as `H::A`. – user4581301 Nov 20 '15 at 04:33

0 Answers0