v/vlib/v/checker/tests/generics_method_receiver_ty...

17 lines
212 B
V

struct Node<T> {
val T
name string
}
pub fn (x Node) str() string {
return 'Value is : ${u16(x.val)}\nName is : $x.name'
}
fn main() {
xx := Node<u16>{
val: u16(11)
name: 'man'
}
println(xx.str())
}