Generics of Custom Classes, How to?
Monkey Forums/Monkey Programming/Generics of Custom Classes, How to?
| ||
Hi! I'm a bit confused about generics. This works: ... Local obj:Object = new Test<Int>() Local t:Test<Int> = Test<Int>(obj) ... Class Test<T> End But this doesnt: ... Local obj:Object = new Test<Image>() Local t:Test<Image> = Test<Image>(obj) ... Class Test<T> End I get a Error : Identifier 'Test' not found. What i'm doing wrong? Thanks! |
| ||
Looks like a bug to me. At first I thought maybe you weren't importing mojo, but my test confirmed your problem. Just to prove it's not something to do with it being a Mojo class, I tried this (which also fails). Class Test<T> End Class Foo End Function Main:Int() Local obj:Object = new Test<Foo>() Local t:Test<Foo> = Test<Foo>(obj) Return 0 End Might want to repost this in the Bugs forum. |
| ||
Done! Hope mark sees it soon :) |