Does Alice support polymorphism?
polymorphism Unfortunately, Alice does not support this sort of functionality directly. There are a few ways around this, but they aren’t nearly as elegant as the solution you’re looking for. The first way to do this is to write a method external to the objects in the list (off of world) that takes an object as a parameter. If then go to any object’s questions and scroll down to “other”, you’ll find the question called “object”‘s part named “key”. This question lets you any part on an object–whether it’s there or not (it will throw an error if you try to reference a part that doesn’t exist, so be aware of that when using it). You can then write a generalize method that takes in any given chicken and has it look for food. If you don’t want to deal with the “part named” question, then the other option is to write a similar function but use if/else statements to determine which chicken is passed in.