Multiple Inheritance

前端 未结 4 952
离开以前
离开以前 2021-01-17 04:42
#include
using namespace std;

class A

{
   int a;
   int b;
   public:
   void eat()
   {
      cout<<\"A::eat()\"<

        
4条回答
  •  心在旅途
    2021-01-17 05:02

    Use a cast - static_cast is required here to cast up the heirarchy.

    main()
    {
      D obj;
      foo(static_cast(&obj));
    }
    

提交回复
热议问题