C++ Multiple Inheritance - why you no work?

前端 未结 2 792
面向向阳花
面向向阳花 2021-01-12 03:53

I am trying to figure out an interesting multiple inheritance issue.

The grandparent is an interface class with multiple methods:

class A
{
public:
          


        
2条回答
  •  醉梦人生
    2021-01-12 04:50

    You need to make your base classes virtual in order for them to inherit properly. The general rule is that all non-private member functions and base classes should be virtual UNLESS you know what you're doing and want to disable normal inheritance for that member/base.

提交回复
热议问题