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

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.

主站蜘蛛池模板: 察雅县| 容城县| 陕西省| 巫溪县| 科技| 大荔县| 南部县| 吕梁市| 固镇县| 利川市| 横山县| 巴里| 武安市| 南靖县| 如皋市| 昌图县| 高尔夫| 五家渠市| 襄城县| 顺昌县| 南京市| 天气| 湖北省| 荃湾区| 临沂市| 商河县| 庄浪县| 怀化市| 尼勒克县| 都兰县| 大埔区| 克拉玛依市| 阳新县| 唐河县| 申扎县| 平武县| 云霄县| 广丰县| 绍兴市| 长丰县| 日土县|