1
class A  
{  
private:  
        int a,b,c;  
public:
        virtual int get()=0;
         friend class B;
};

class B{
//here I want to access private variables of class A that is a, b and c
};

class C:public class A
{  
        int get(){    
       //some code  
        }  
};

クラス B のクラス A のプライベート メンバーにアクセスする方法。クラス A のオブジェクトは抽象的であるため作成できません。それを行うにはクラスCのオブジェクトを使用する必要がありますが、どうすればよいですか?

4

2 に答える 2