Actually this is better code for the question
https://gotipplay.golang.org/p/GQlB2tyyj53

czwartek, 21 lipca 2022 o 08:08:51 UTC+2 Slawomir Pryczek napisaƂ(a):

> https://gotipplay.golang.org/p/ojY3RRJRJgy
>
> func GenericData[T DATA, T1 any]() {
> }
>
> When DATA is interface of pointer type, so methods can modify the 
> underlying structure...
>
> // T1 <- any type, so can instantiate but can't increment as there's no 
> interface
> var tt T1 
> fmt.Println(tt)
>
> var d T      // T <- DATA interface type, so can't initialize but can 
> instantiate
> can't instantiate because the object will never initialize (nil)
>
> Can i create new object of type DATA somehow?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/4b36ca5e-ab1e-4468-85e5-0467efa34ca9n%40googlegroups.com.

Reply via email to