在ruby中使用@@和实例变量

时间:2017-01-26 06:43:56

标签: ruby class variables

我想弄清楚以下内容: 这个

有什么区别
class Car
    @@count = 1
end

和这个

class Car
    count = 1
end

我知道@@用于定义一个类变量,但是不是在一个被认为是该类范围内的变量的类中声明的变量吗?

0 个答案:

没有答案