Anonymous user
Constrained genericity: Difference between revisions
m
→{{header|C#}}: Fix header link
m (→{{header|C#}}: Fix highlighting) |
m (→{{header|C#}}: Fix header link) |
||
Line 36:
The lunch box contains two banana and one tomato.
=={{header|C sharp|C#}}==
In C#, type constraints are made on the type hierarchy, so here we make <code>IEatable</code> an interface, with an <code>Eat</code> method. Types which are eatable would have to implement the <code>IEatable</code> interface and provide an <code>Eat</code> method.
|