VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Eater Polymorphism Example

Azrael  (4 Submissions)   Object Oriented Programming (OOP)   Visual Basic 3.0   Intermediate   Wed 3rd February 2021

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.

Assumes
Nothing.

Returns
Nowt

Side Effects
None, unless I've inadvertently named one of the beasts after your pet and you're sensitive ... ;-) Dogs nearly always win, by the way.

Rate Eater Polymorphism Example (5(5 Vote))

Download Eater Polymorphism Example

Eater Polymorphism Example Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters