What i think is that dynamic type means dynamically allocated object
using new.
Nope.
The dynamic type is the real type of an object that might be accessed via a reference (pointer included) that point to a base type of its real type.
That is, if we have :
class A {
};
class B : public A { };
B l;
A& k = l;
Here k is a reference to an object of type A, but the real type of the referred object, its dynamic type, is B.
Here "dynamic" has the meaning of "known only at run-time".
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…