#include <iostream>
using namespace std;
int main()
{
return 0;
}
//向下类型转换和向上类型转换;
/*
例如:
基类:
Animal ;
子类:
Cat;
因为子类是继承了基类的,所以子类比基类的容量要大。因此,基类类型不能强转为子类。
例如:
Animal * animal = new Animal;
Cat * cat = (Cat*) animal;
基类转派生类 是不安全的。---向下类型转换,内存泄露;
派生类转基类 是安全的。 ---向上类型转换,安全的;
如果发生了多态,总是安全的。
Animal * animal = new Cat;
*/