zoukankan      html  css  js  c++  java
  • C++ 类初始化的顺序

    • First, and only for the constructor of the most derived class as described below, virtual base classes shall be initialized in the order they appear on a depth-first left-to-right traversal of the directed acyclic graph of base classes, where “left-to-right” is the order of appearance of the base class names in the derived class base-specifier-list.

    • Then, direct base classes shall be initialized in declaration order as they appear in the base-specifier-list (regardless of the order of the mem-initializers).

    • Then, non-static data members shall be initialized in the order they were declared in the class definition (again regardless of the order of the mem-initializers).

    • Finally, the compound-statement of the constructor body is executed. [ Note: the declaration order is mandated to ensure that base and member subobjects are destroyed in the reverse order of initialization. —end note ]

  • 相关阅读:
    _#【命名】 / _
    _#【插件】
    _#【命名】样式类
    linux dd命令
    python urllib2和urllib的区别
    hadoop的find
    hadoop的fs基本命令
    /etc/profile和 . profile 文件
    广告sdk
    linux下查找文件的常用命令
  • 原文地址:https://www.cnblogs.com/yayagamer/p/2320902.html
Copyright © 2011-2022 走看看