2016-02-05 04:30:34 -05:00
|
|
|
import simple_print: *
|
2016-02-20 02:36:35 -05:00
|
|
|
|
2016-02-13 16:56:37 -05:00
|
|
|
obj SimpleContainer<T> {
|
|
|
|
|
var data: T
|
2016-02-15 16:31:01 -05:00
|
|
|
fun print_data() {
|
|
|
|
|
var indirection: T
|
|
|
|
|
indirection = data
|
|
|
|
|
println(indirection)
|
|
|
|
|
}
|
2016-02-20 02:36:35 -05:00
|
|
|
fun with_other<U>(other: U) {
|
|
|
|
|
var indirection: U
|
|
|
|
|
indirection = other
|
|
|
|
|
println(data)
|
|
|
|
|
println(other)
|
|
|
|
|
}
|
|
|
|
|
fun return_as<U>(): U {
|
|
|
|
|
var indirection: T
|
|
|
|
|
indirection = data
|
|
|
|
|
return data
|
|
|
|
|
}
|
2016-02-15 16:31:01 -05:00
|
|
|
fun construct(dataIn: T) data = dataIn
|
2016-02-13 16:56:37 -05:00
|
|
|
}
|
2016-01-10 18:26:31 -05:00
|
|
|
fun main(): int {
|
2016-02-20 02:36:35 -05:00
|
|
|
var it: SimpleContainer<int>
|
|
|
|
|
it.data = 8
|
|
|
|
|
it.with_other("Wooo object template")
|
|
|
|
|
println(it.return_as<float>())
|
2016-01-10 18:26:31 -05:00
|
|
|
}
|
2015-12-26 01:52:29 +00:00
|
|
|
|