So I got the following Structure.
abstract class Item
class Apple
class Stick : Carriable
interface Carriable
void Equip(CarriableItem item)
Now I want a function where I can pass Items which implements Carraible. So that I can pass Stick but not an Apple.
I try to avoid an if inside of that function in case the Item cant be cast to Carriable.
Aucun commentaire:
Enregistrer un commentaire