To understand this behavior, consider what would happen if the derived-class version of a virtual function were called from a base-class constructor (or destructor).
什么情况下才会出现父类的构造函数调用子类的函数的情况?
...全文
31829打赏收藏
父类的构造函数中调用子类的函数
To understand this behavior, consider what would happen if the derived-class version of a virtual function were called from a base-class constructor (or destructor). 什么情况下才会出现父类的构造函数调用子类的函数的情况?
如果能运行就是运行错,但是现在编译器一般很聪明,在编译期就给你错误,禁止你这么用。
[Quote=引用 13 楼 mrrat521 的回复:]
引用 6 楼 xunmengren2009 的回复:
To understand this behavior, consider what would happen if the derived-class version of a virtual function were called from a base-class constructor (or destructor).
[Quote=引用 6 楼 xunmengren2009 的回复:]
To understand this behavior, consider what would happen if the derived-class version of a virtual function were called from a base-class constructor (or destructor).