Groovy 中的“私有"是什么意思? [英] What does 'private' mean in Groovy?
本文介绍了Groovy 中的“私有"是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面的代码设置了一个私有方法.那么私密到底有多私密?
The following code sets a private method. So how private really is private?
public class Person {
private String name
}
def u = new Person(name:"Ron")
println u.name
推荐答案
按照设计 Groovy 应该尊重 private 修饰符,但是当前的实现没有考虑到它.
By design Groovy should respect the private modifier, however the current implementation takes no account of it.
这篇关于Groovy 中的“私有"是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文