If I have two different classes that are both derived from the same parent class, is it possible for one class to access the parent members of the other class? Example:
This gives me "int Parent::value is protected". Is it possible in another way?Code:#include <iostream> using namespace std; class Parent { protected: int value; }; class Child_A : public Parent { public: void Foobar(Parent &other) { cout << other.value << endl; } }; class Child_B : public Parent { }; int main() { Child_A a; Child_B b; a.Foobar(b); return 0; }