Could someone help me understand what is going to be returned in following piese of code and why (the processing logic) (I have no way to compile it by myself now....)
struct A {
int value;
virtual int access() { return this->value; }
};
struct B {
int value;
virtual int access() { return this->value; }
};
struct C : public A, public B {
int better_value;
virtual int access() { return this->better_value; }
};
int use(B *b)
{
return b->access();
}
... C c; use(&c); ...
I am not clear by the call: use(&c) - the access() is used from the C class implementation or from the B class?
So, will it return the C::better_value or B::value?
And one more question:
If I try to set the c::value - what value it going to set: B::value or A::value, or I have to specify it explicitely: c::B::value or c::A::value?
Appreciate your help!