attr_reader : name | 表示name只讀 |
---|---|
attr_write : name | 表示name只寫 |
attr_accessor: name | 表示可讀可寫 |
module M def mm puts "helloworld!" end end class A include M def initalize puts "aa" end end a = A.new a.mm
class Application attr_accessor :status def initialize end public def print_status puts "all system go!" end private def password @password = 123456 end end