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

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.

主站蜘蛛池模板: 彭州市| 潮安县| 武宣县| 杂多县| 济阳县| 舟曲县| 秦皇岛市| 宜黄县| 仙游县| 滁州市| 滨海县| 邹城市| 玛多县| 晋中市| 平遥县| 买车| 龙陵县| 剑阁县| 安顺市| 浠水县| 嘉善县| 新宾| 佛冈县| 阿拉善盟| 右玉县| 庆元县| 定州市| 息烽县| 太仓市| 丹寨县| 建瓯市| 湖南省| 宣武区| 遂平县| 四子王旗| 保山市| 红桥区| 五河县| 延津县| 璧山县| 台南市|