25 lines
404 B
V
25 lines
404 B
V
fn get_name<A, B>(a A, b B) string {
|
|
return '$a, $b'
|
|
}
|
|
|
|
struct Foo {}
|
|
|
|
fn (f Foo) get_name<A, B>(a A, b B) string {
|
|
return '$a, $b'
|
|
}
|
|
|
|
fn main() {
|
|
ret1 := get_name<int>(11, 22)
|
|
println(ret1)
|
|
|
|
ret2 := get_name<int, int, string>(11, 22, 'hello')
|
|
println(ret2)
|
|
|
|
foo := Foo{}
|
|
ret3 := foo.get_name<int>(11, 22)
|
|
println(ret3)
|
|
|
|
ret4 := foo.get_name<int, int, string>(11, 22, 'hello')
|
|
println(ret4)
|
|
}
|