摘要: #overrideto_smethodclassThingdefset_name(aName)@name=aNameenddefget_namereturn@nameendendclassTreasuredefinitialize(aName,aDescription)@name=aName@description=aDescriptionenddefto_s#overridedefaultto_smethod"The#{@name}Treasureis#{@description}\n"endendthing1=Thing.newthing1.set_name(" 阅读全文
posted @ 2012-06-12 17:39 Master HaKu 阅读(1596) 评论(0) 推荐(0) 编辑
摘要: #ClassDemoclassDogdefset_name(aName)@myname=aNameenddefget_namereturn@mynameenddeftalkputs"Woo!I'm"+get_nameendendclassCatdefset_name(aName)@myname=aNameenddefget_namereturn@mynameenddeftalkputs"Miao!I'm"+get_nameendend#CreateinstancesoftheDogandCatclassesdog1=Dog.newdog2 阅读全文
posted @ 2012-06-12 17:37 Master HaKu 阅读(163) 评论(0) 推荐(0) 编辑