#include <iostream>
#include <string>
using namespace std;
class Animal1
{
public:
virtual void fun1() = 0;
};
class Animal2
{
public:
virtual void fun2() = 0;
};
class Cat : public Animal1, public Animal2
{
public:
virtual void fun1()
{
cout << "fun1" << endl;
}
virtual void fun2()
{
cout << "fun2" << endl;
}
};
int main(void)
{
Animal1 *a1 = new Cat;
Animal2 *a2 = new Cat;
a1->fun1(); //fun1
a2->fun2(); //fun2
delete a1;
delete a2;
return 0;
}
释放指针a2内存的时候直接程序崩溃了,求大神帮助!