embedding

109 views
Skip to first unread message

Michał Pawełek

unread,
Sep 28, 2020, 12:55:41 PM9/28/20
to golang-nuts
https://play.golang.org/p/CBuzITRmTiP  

Why isn't T1 allowed to pass to f ?

burak serdar

unread,
Sep 28, 2020, 1:00:10 PM9/28/20
to Michał Pawełek, golang-nuts
On Mon, Sep 28, 2020 at 10:55 AM Michał Pawełek <mchle...@gmail.com> wrote:
>
> https://play.golang.org/p/CBuzITRmTiP
>
> Why isn't T1 allowed to pass to f ?

func f requires an argument of type T. You cannot pass a value of type
T1. However, T1 has T embedded in it, so you can pass:

f(t1.T)


>
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/76a2daf6-8b37-4b55-bfc0-c6621551e464n%40googlegroups.com.

Michał Pawełek

unread,
Sep 28, 2020, 1:03:55 PM9/28/20
to golang-nuts
Thanks !
Reply all
Reply to author
Forward
0 new messages