Forum: Ruby Access Control confusion

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7adbf4434f63cedd463196b652fa7a44?d=identicon&s=25 Chang Min Jeon (Guest)
on 2009-01-01 14:53
(Received via mailing list)
I read Ruby User's Guide <http://www.rubyist.net/~slagell/ruby/>
created by Yukihiro Matsumoto

http://www.rubyist.net/~slagell/ruby/accesscontrol.html

and i have a question about access control.
Access Control section explain method following code.

>* def square(n)*
    |*   n * n*
    |* end*

Object class has square method.

But it is not allowed access of square method following document.

We are not allowed to explicitly apply the method to an object:

ruby>* "fish".square(5)*
*ERR: (eval):1: private method `square' called for "fish":String*

But it is operated when i write code above in ruby 1.8.7

What is the matter ?
wrong document ?
This topic is locked and can not be replied to.