CSC 216 F09/polymorphism4: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
== | == Background == | ||
Polymorphism is having one class take multiple different forms of objects. This allows it to reference itself and objects of other classes easily. | Polymorphism is having one class take multiple different forms of objects. This allows it to reference itself and objects of other classes easily. | ||
Line 7: | Line 7: | ||
This is a rule that checks to see if you are allowed to use polymorphism on the class in reference to another. For example car is-a drivable so drivable is able to do what a car can do,however drivable is-not-a car so car cannot do what drivable can. | This is a rule that checks to see if you are allowed to use polymorphism on the class in reference to another. For example car is-a drivable so drivable is able to do what a car can do,however drivable is-not-a car so car cannot do what drivable can. | ||
== Props == | |||
Just need a few pieces of paper for each team | |||
== The Game == | == The Game == |
Revision as of 05:20, 13 December 2009
Background
Polymorphism is having one class take multiple different forms of objects. This allows it to reference itself and objects of other classes easily.
Is-a
This is a rule that checks to see if you are allowed to use polymorphism on the class in reference to another. For example car is-a drivable so drivable is able to do what a car can do,however drivable is-not-a car so car cannot do what drivable can.
Props
Just need a few pieces of paper for each team
The Game
Split the group into 4 groups of players. This game is going to be played by the teacher (or whoever is directing the learning exercise to give a topic (a broad topic is best). For example "Living Things" now every group has to come up with a thing that inherits from "Living Thing" and then another thing that inherits from that etc. Make a list of 5 things .However if any groups have the same thing inherited than that point is not counted for any team that has it. An example five things would be...
Topic:Living Things
Mammal
Platypus
Heart
Cell
Atom
Now if another team had
Topic:Living Things
Animal
Mammal
Primate
Human
Woman
The point mammal would be discounted for both teams.
Also any point that is not a valid inheritance is obviously discounted. The group with the most points after 5 rounds wins.
The number of groups , things inherited , and rounds could change based on how many people there are this is just a recomendation. It also needs to be played with groups of 3+ because groups of 2 would always tie.
Acknowledgments
This exercise was created by Armando Velez