Last active
August 5, 2020 23:31
-
-
Save nobishino/b6c03595ee852d01815a9286425c902c to your computer and use it in GitHub Desktop.
Quizground-2.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type T struct { | |
x int | |
} | |
func (t *T) Set(x int) { | |
t.x = x | |
} | |
type S struct { | |
T | |
} | |
func main() { | |
s := S{} | |
s.Set(1) | |
fmt.Println(s.x) | |
} | |
// playgroundで試したい方は https://play.golang.org/p/zkY6RCDPTZT | |
// (1) compile error(build error) | |
// (2) runtime error | |
// (3) 1と表示される | |
// (4) 0と表示される | |
// 解説リンクは(自分が理解出来次第)追加されます |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment