Python
Pythonã ã¨ã¨ã©ã¼ã«ãªãã...
class D: def x(self): return "x" class D: def y(self): return "y" obj = D() print obj.x() print obj.y() #=> Traceback (most recent call last): #=> File "qr_96298g4R.py", line 10, in <module> #=> print obj.x() #=> AttributeError: D instance has no attribute 'x'
Ruby
Rubyã§ã¯æ¢åã®ã¯ã©ã¹ãåãªã¼ãã³ãã¦ãã¡ã½ããã追å ããã
class D def x "x" end end class D def y "y" end end obj = D.new puts obj.x puts obj.y #=> x #=> y
Ruby ã®classãã¼ã¯ã¼ãã¯ãã¯ã©ã¹å®£è¨ã¨è¨ããããã¹ã³ã¼ãæ¼ç®åã®ãããªãã®ã§ããã
ï¼ãã¡ã¿ããã°ã©ãã³ã°Rubyã 1.2.1 ã¯ã©ã¹å®ç¾©ã®ä¸èº«ï¼