https://golang.org/ref/spec#Type_assertions

    var x interface{} = 7  // x has dynamic type int and value 7
    i := x.(int)           // i has type int and value 7

    type I interface { m() }
    var y I
    s := y.(string)        // illegal: string does not implement I (missing 
method m)
    r := y.(io.Reader)     // r has type io.Reader and y must implement 
both I and io.Reader

I don't understand the comment of the last line. Can someone explain it for 
me?

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to