Why can't I declare a friend through a typedef?

前端 未结 4 652
野性不改
野性不改 2020-12-08 21:56

Does anyone know why typedefs of class names don\'t work like class names for the friend declaration?

class A
{
public:
};

class B : public A
{
public:
   t         


        
4条回答
  •  攒了一身酷
    2020-12-08 22:52

    I tried in the VC++ 8.0 the code:

    ...
    class C
    {
    public:
      friend class A;       
      friend X;             
      friend B::SUPERCLASS; 
    };
    ...
    

    It is compiled without errors.

    I am not aware whether it MS specific or not.

提交回复
热议问题