29
May
Posted by liubin as Ruby
| 2,176 Views
- class PT
- private
- def private_method
- puts "private method executed!"
- end
- end
-
- p = PT.new
- begin
- p.private_method
- rescue NoMethodError
- puts "call Private method error!"
- end
-
- PT.new.method(:private_method).call
最后执行结果如下:
>ruby C:/magic.rb
call Private method error!
private method executed!
Related posts for the current post:
2 Responses
the best movies review
September 18th, 2008 at 20:33
1download Friends with Money videos…
DOWNLOAD MOVIE Friends with Money
Just $2.99 for a complete movie! No additional software or browser plug-ins required! You can play them for unlimited number of times whenever you want. Downloaded movies will work perfectly on any PC, DVD player, PD…
review game film
September 20th, 2008 at 21:33
2full length Coyote Ugly vids…
DOWNLOAD MOVIE Coyote Ugly
Just $2.99 for a complete movie! No additional software or browser plug-ins required! You can play them for unlimited number of times whenever you want. Downloaded movies will work perfectly on any PC, DVD player, PDA etc.
…
Categories
Archives
Links
Meta
Recent Entries
Most Reads