A:
virtual function uses virtual calling. virtual calling is a kind of operation mechanism which can run on the condition of part information being provided. it allows us to call a function that we only know the interface while not know accurate object type of the function.
However if we create an object, you must know what kind of the object is accrurately! Therefore, the constructor can not be virtual.
转载于:https://www.cnblogs.com/Winston/archive/2008/02/26/1081860.html
本文解释了虚拟函数如何使用虚拟调用机制,并说明了为何构造函数不能被声明为虚拟的。虚拟调用允许通过基类指针调用派生类中的函数,但必须知道对象的确切类型才能创建对象。
5810

被折叠的 条评论
为什么被折叠?



