golangã«éããªããã§ãããABãã¹ãã®æ¯ãèããã¡ããã¨ããè¨è¨ã®ãã¨å®è£ ããã®ã£ã¦é£ããã¨æã£ã¦ãã¾ãã ãããããã¿ã¼ã³ã¨ãã¦ã¯ãUserã¨ããæ§é ä½ããã£ã¦ãããã«å¯¾ãã¦ABãã¹ãã«ããæ¯ãèããå¤ããããã«å®è£ ããããã¨ãã¨æãã¾ãã User type User struct { ID int Name string } é¢æ°ãçãã ãã¾ãèããã«é¢æ°ãä½ã£ã¦ããæ¹é func (u User) IsFoo() bool { return u.ID%10 == 0 } func (u User) IsBar() bool { return u.ID%10 == 1 } func main() { u := User{ID: 1, Name: "kaneshin"} fmt.Println(u.IsFoo()) fmt.Println(u.IsBar()) } ã³ã¼ãï¼ht
{{#tags}}- {{label}}
{{/tags}}