We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
you need to try the dynamic cast, because spell is a pointer if the cast fail the dynamic cast become NULL(for a reference it would be a bad_cast exception if i remember correctly) and you know now spell isn't the type that you try to cast, with if else statement and 4 dynamic cast you can arrive to determine what kind of spell it is! good luck for the LCS too after that
Magic Spells
You are viewing a single comment's thread. Return to all comments →
you need to try the dynamic cast, because spell is a pointer if the cast fail the dynamic cast become NULL(for a reference it would be a bad_cast exception if i remember correctly) and you know now spell isn't the type that you try to cast, with if else statement and 4 dynamic cast you can arrive to determine what kind of spell it is! good luck for the LCS too after that
if(fbl==NULL){ Frostbite* fbi = dynamic_cast< Frostbite*>(spell); if(fbi==NULL){Thunderstorm* ts = dynamic_cast< Thunderstorm*>(spell); ...