继承和特质

This commit is contained in:
罗祥
2019-05-09 18:05:37 +08:00
parent 1fc729d871
commit 43876f15af
2 changed files with 83 additions and 1 deletions

View File

@ -64,7 +64,7 @@ object Person {
### 2.1 成员变量可见性
Scala中成员变量的可见性默认都是public但是为了保证其不被外部干扰,建议声明为private并通过getter和setter方法进行访问。
Scala中成员变量的可见性默认都是public如果想要保证其不被外部干扰,可以声明为private并通过getter和setter方法进行访问。
### 2.2 getter和setter属性