gpt4 book ai didi

c++ - 关于C++虚基类和虚继承

转载 作者:行者123 更新时间:2023-11-30 02:10:07 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
gcc c++ virtual inheritance problem

大家好, 我正在阅读 scott myers 的 Effective C++ 书籍。下面提到虚基类和虚继承。

The rules governing the initialization of virtual base classes are more complicated and less intuitive than are those for non-virtual bases. The responsobility for initializing a virtual base is borne by the most derived class in the hierarchy. When a new derived class is added to the hierarchy, it must assume initialization responsiblities for its virtual bases (both direct and indirect)

问题是在上面的陈述中,虚拟基类的初始化规则是什么,以及上面提到的派生类必须承担的责任是什么。请举例说明。

谢谢!

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com