root/cobra/trunk/Tests/240-generics/400-generic-methods/102-generic-method-in-generic-class.cobra
| Revision 2281, 311 bytes (checked in by Chuck.Esterbrook, 2 years ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | # the generic method is declared inside a generic class |
| 2 | |
| 3 | class A<of T> |
| 4 | |
| 5 | def foo<of U>(i as int) as U? |
| 6 | where U must be class |
| 7 | return nil |
| 8 | |
| 9 | def bar<of U>(i as int) as List<of U> |
| 10 | return List<of U>() |
| 11 | |
| 12 | def baz<of U>(t as List<of U>) |
| 13 | pass |
| 14 | |
| 15 | |
| 16 | class Program |
| 17 | |
| 18 | def main |
| 19 | a = A<of Program>() |
| 20 | CobraCore.noOp(a) |
Note: See TracBrowser
for help on using the browser.



