#!/usr/bin/ruby
# Class method
class TestClass
def initialize(name="test")
@name = name
end
def TestClass.show
puts @name # always nil
end
end
a = TestClass.new
TestClass.show
# a.show # ERROR
Ruby Справочник v0.05 © 2007-2024 Igor Salnikov aka SunDoctor