Anyone can explain, why after IF statement can can not use object methods?
if(state is CurrentPlayerState){
state.getPermanentStatsByTitle(); <- The method 'getPermanentStatsByTitle' isn't defined for the type 'PlayerState'.
}
PlayerState - is abstract and really not contain the method. But CurrentPlayerState has the method.
Try casting it:
if(state is CurrentPlayerState){
(state as CurrentPlayerState).getPermanentStatsByTitle();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.