marinho.tobolla@syncity.de
8/20/2006 6:16:00 AM
Why doesn´t the call with self doesn´t work ? I know that private means
private to the object, but the private methode call is within the same
object (at least it´s what i think). Doesn´t self mean "the object
himself" ? So why is this error occuring ?
test.rb:14:in `with_self': private method `private_methode' called for
#<PrivateTest:0x2aaaaab00508> (NoMethodError)
[code]
class PrivateTest
def private_methode()
puts("I am private")
end
def without_self()
puts("without self")
private_methode()
end
def with_self()
puts("with self")
self.private_methode()
end
private :private_methode
end
test = PrivateTest.new
test.without_self()
test.with_self()
[/code]