Never call virtual function during construction or destruction
Calling virtual functions from a constructor or destructor is considered dangerous most of the times and must be avoided whenever possible. All the C++ implementations need to call the version of the function defined at the level of the hierarchy in the current constructor and not further.
You can call a virtual function in a constructor. The Objects are constructed from the base up, “base before derived”.
不要在构造或析构方法中调用虚拟方法。
从构造方法或析构方法中调用虚拟方法在大多数情况下被认为是危险的,必须尽可能地避免。所有的C++实现都需要在当前构造函数中调用定义在层次结构中的函数版本,而不是更进一步。
你可以在构造方法中调用一个虚拟方法。对象的构造是自下而上的,"先基后派"。