Eater Polymorphism Example
Probably useful if you want to learn about polymorphism, objects and collections. This is an example of polymorphism running out of control. 1000 generic Beast-class objects are created, each assigned to be either a Dog, Cat, or Mouse. Then, using calls to the Beast class, they try to eat each other, until only one (the biggest) remains. Try messing around with it ... a larger animal can only eat a smaller one, except in the case of mice who can eat an animal of the same size - it's only fair, they start so small.
Original Author: Azrael
None, unless I've inadvertently named one of the beasts after your pet and you're sensitive ... ;-)
Dogs nearly always win, by the way.
About this post
Viewed: 66 times
Posted: 9/3/2020 3:45:00 PM
Size: 5,738 bytes
No comments have been added for this post.
You must be logged in to make a comment.