Inside the C++ Object Model:构造语意(chapter5)

看到构造语意的其中一节“继承体系下的对象构造”(5.2节)的最后,看来原文,发现侯杰的翻译有问题,怪不得读起来不顺。

What about when providing an argument for a base class constructor? Is it still physically safe to invoke a virtual function of the class within its constructor‘s member initialization list? No. The vptr is either not set or set to the wrong class. Further, any of the data members of the class that are accessed within the function are guaranteed to not yet be initialized.

中文写成了“何时需要供应参数给一个base class constructor?”,其实看下去就知道,这一节与上一节对应的,即在讨论完初始化列表中用virtual函数初始化数据成员后,讨论一下如果用virtual函数在初始化列表中给基类构造函数提供参数的情况(这种情况是不安全的,有问题的)。

Inside the C++ Object Model:构造语意(chapter5),布布扣,bubuko.com

Inside the C++ Object Model:构造语意(chapter5)

上一篇:[Javascript] “||”和“&&”的灵活运用


下一篇:Spring的事物处理(转)