21 lines
323 B
Text
21 lines
323 B
Text
use Collection.Generic;
|
|
|
|
interface Eatable {
|
|
method : virtual : Eat() ~ Nil;
|
|
}
|
|
|
|
class FoodBox<T : Eatable> {
|
|
food : List<T>;
|
|
}
|
|
|
|
class Plum implements Eatable {
|
|
method : Eat() ~ Nil {
|
|
"Yummy Plum!"->PrintLine();
|
|
}
|
|
}
|
|
|
|
class Genericity {
|
|
function : Main(args : String[]) ~ Nil {
|
|
plums : FoodBox<Plum>;
|
|
}
|
|
}
|