How come my compiler does not give me a warning or an error for this code:
class A {};
class B : public A{};
class C : public A{};
int main(int argc,char** args)
{
B b;
A& a = b;
C c;
a = c;
}
I would tend to think that this would result in the data being stored in the "b" variable is no longer of type "B" and is going to give me a bunch of problems....so why am I able to do this.