官术网_书友最值得收藏!

Class variables

Class variables are variables that are available to a particular class. The syntax for this variable is @@. Consider this example:

class MyClass 
@@teams = ["A's", "Tigers"]
end

Though they look simple, you'll rarely use class variables in real-world applications because you can accomplish the same using local or instance variables. Nothing is wrong if you use class variables, but it's not commonly utilized by most developers. In fact, the local and instance variables are likely to make up more than 98 percent of variables in your applications, so it's a good idea to be familiar with them.

主站蜘蛛池模板: 连州市| 元氏县| 耿马| 土默特右旗| 广丰县| 长岛县| 阜南县| 泰顺县| 巴彦淖尔市| 分宜县| 大宁县| 汉中市| 攀枝花市| 商丘市| 克山县| 纳雍县| 巨野县| 东兴市| 青冈县| 雷山县| 育儿| 祁东县| 紫阳县| 四平市| 汉寿县| 崇文区| 云和县| 吴川市| 班玛县| 汉沽区| 阿拉善右旗| 庆云县| 博白县| 汝城县| 屏山县| 边坝县| 县级市| 寿阳县| 安新县| 乐至县| 通江县|