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

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.

主站蜘蛛池模板: 嘉定区| 西乌珠穆沁旗| 龙游县| 都匀市| 西乌| 霍城县| 明星| 轮台县| 通河县| 通州区| 灵台县| 普安县| 安乡县| 翁源县| 双城市| 泸西县| 揭阳市| 邵东县| 天津市| 三亚市| 手机| 新沂市| 安远县| 延庆县| 乌海市| 阳东县| 崇州市| 区。| 横山县| 鄱阳县| 松潘县| 临夏县| 福贡县| 大方县| 伊宁县| 甘谷县| 台南县| 大城县| 东宁县| 东乌珠穆沁旗| 定陶县|