LoginSignup
4
4

More than 5 years have passed since last update.

引数有り無しでgetter/setterを切り替えるメソッド(一行で)

Posted at

天啓メモ。

class K
  val: (@_val=@_val) -> @_val

使う時

a = new K()
a.val("A")
console.info(a.val())

なんでしょね。

4
4
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
4
4