mardi 24 octobre 2017

Can a virtual function access the friend of base class?

I am just a beginner in C++, my question is can a virtual function access the friend of base class? or the virtual function will only access the class's friend function in which it is defined?

class A
{
friend class B;
public:
virtual void setData();
};

now if a class is derived from class A

class C:public class A{
public:
setData()
{
  //can I use the friend class B here?
}
};

Aucun commentaire:

Enregistrer un commentaire