edit: nevermind, solved...I'd declared type in ClassB AND ClassC....
So I have a pointer, named PointA, in a class called ClassA.
ClassA and ClassB are both derived from ClassC, which has a variable called type.
In a section of code I assign a new instance of ClassB to ClassA's PointA variable. The pointer is declared to point to ClassC, of which ClassB is derived from.
I then have a function, in OtherClass (irrelevant), that looks a bit like this:
void OtherClass::function_name(ClassA* A,ClassB* B) {
B->type; //displays the correct value of type
A->PointA->type; //displays the wrong value of type
(A->PointA)->type; //displays the wrong value of type
}
I know that PointA points correctly to the instance of ClassB.
What am I doing wrong to get the incorrect value of type when I use the pointer?
A->PointA->type? - Frédéric Hamidi