LoginSignup
1
1

More than 5 years have passed since last update.

関数を要素に持つ構造体の定義

Posted at

インターフェイスの動作をちょっと変えたいと思い構造体の要素に関数を持つ方法を調べても直ぐに出て来なかったのでメモ

type Hoge struct {
    Huga  func(int) bool
}

これで、Hugaはint型の引数を一つ持ち、bool型を返す関数の型の要素になる

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1