Ruby instance_eval 冲破封装问题

sunjohn · October 18, 2012 · Last by 5long replied at October 18, 2012 · 1855 hits

看 ruby 元编程,读到 instance_eval() 方法时,作者说他会打破封装,没有什么数据时私有的了。 那么有没有啥办法避免这种状况?

所谓权力越大责任也越大。用这个方法的人应该清楚自己在做什么。

You need to Sign in before reply, if you don't have an account, please Sign up first.