Forward declare typedef within C++ class

前端 未结 5 709
长发绾君心
长发绾君心 2021-02-04 06:56

What\'s the best solution to forward declare a typedef within a class. Here\'s an example of what I need to solve:

class A;
class B;

class A
{
    typedef boos         


        
5条回答
  •  北海茫月
    2021-02-04 07:20

    There's no way to forward declare either

    1. A typedef
    2. A name in another class

    So - you can't forward declare a typedef and if you could, you still wouldn't be able to do that, because you'd need to do this:

    class B::Ptr;
    

    and that's not possible

提交回复
热议问题