Hey!
I've been fighting with a problem about using members of a class. I haven't got anything working solution of it. I've tried searching from google too. Probably I just don't know what to search for... Can you help because I know just "ugly" ways of doing this? I'd prefer wise way.
The problem (not real code):
Code:
class C {
public
getC()
private
objC
}
class B : public class C {
public
getB()
private
C objB
}
class A : public class B {
public
getA()
private
B objA
}
main {
A object
C object2 = object.getA().getB().getC()
}
So, I'd like to get to class B or class C in not so ugly way as that. Should I inherit the class B as private, "private class B", or something? Or use protected?