Suppose I have a class with a virtual function and a derived class that implements the virtual function in a different way. Suppose I also have a vector of the base class u
The class that you are actually calling is not a class of Bar, but instead a class of Foo. What you are doing at foo_vector [0] = bar;
is a call of the implicit operator= which is doing its best to make something smart happen. The memory space is still the size of a Foo though, so it can't ever be a Bar.