Ruby之旅(三) 类变量以及类方法
(一)类变量以及类方法
sample code
class BankAccount
@@interestRate = 6.5
def BankAccount.getInterestRate()
@@interestRate
end
attr_accessor :balance
def initialize(bal)
@balance = bal
end
end
puts BankAccount.getInterestRate()
浙公网安备 33010602011771号