In C++, what is a virtual base class?

后端 未结 11 2140
一个人的身影
一个人的身影 2020-11-22 00:55

I want to know what a \"virtual base class\" is and what it means.

Let me show an example:

class Foo
{
public:
    void DoSomething() { /* .         


        
11条回答
  •  伪装坚强ぢ
    2020-11-22 01:10

    Explaining multiple-inheritance with virtual bases requires a knowledge of the C++ object model. And explaining the topic clearly is best done in an article and not in a comment box.

    The best, readable explanation I found that solved all my doubts on this subject was this article: http://www.phpcompiler.org/articles/virtualinheritance.html

    You really won't need to read anything else on the topic (unless you are a compiler writer) after reading that...

提交回复
热议问题