Hi,
I have done some reading and searching without finding how subclasses relate to friend classes.
Here is a little scenario:
class Dog;
class Cat{
public:
int getAge(){return age};
protected:
friend class Dog;
int age;
};
class Dog{
public:
Boolean foo(){return True};
protected:
friend class Cat;
};
class Puppy : public Dog{
};
class Kitty : public Cat{
};
How do the subclasses Puppy and Kitty relate to each other, and also to the parent classes Dog and Cat? What is inherited, and what limitations do they have (what objects will have access to what?). What effect does making the friend class protected have (and how would making it public make it different?)
I hope someone can help me reveal a bit more of how C++ inheritance works in general, and how it applies to friends as well.
Thanks in advance for any help!