未避免執行風險,加上instanceof判斷式
class Animal extends Organism{...}
class Mammalian extends Animal{...}
Animal animal = null;
if(new Mammalian() instanceof Animal){
animal = (Animal)new Mammalian();
}
##ShowAll##
工作忙了,事情多了,越發越少,備忘錄就到這個段落吧!
class Animal extends Organism{...}
class Mammalian extends Animal{...}
Animal animal = null;
if(new Mammalian() instanceof Animal){
animal = (Animal)new Mammalian();
}
##ShowAll##
0 意見 :
張貼留言