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

后端 未结 11 2163
一个人的身影
一个人的身影 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:26

    Virtual classes are not the same as virtual inheritance. Virtual classes you cannot instantiate, virtual inheritance is something else entirely.

    Wikipedia describes it better than I can. http://en.wikipedia.org/wiki/Virtual_inheritance

提交回复
热议问题