zoukankan      html  css  js  c++  java
  • 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函数在初始化列表中给基类构造函数提供参数的情况(这种情况是不安全的,有问题的)。

  • 相关阅读:
    AcWing356 次小生成树(lca)
    牛客 Rinne Loves Edges(dp)
    软件的生命周期和测试流程
    软件测试的学习经历回顾-第一天
    java List集合
    c#Socket通信
    c#线程2
    c#线程1
    c#Linq联合查询
    c#拓展方法
  • 原文地址:https://www.cnblogs.com/lailailai/p/3749700.html
Copyright © 2011-2022 走看看