scala学习笔记:理解类继承
scala> import scala.reflect._
import scala.reflect._
scala> class Person(@BeanProperty var name: String, val gender: Boolean=true){}
defined class Person
scala> val p = new Person("bluejoe")
p: Person = Person@5905edf2
scala> p.setName("yahoo")
scala> p.getName
res1: String = yahoo
scala> p.name
res2: String = yahoo
scala> class Man(val name2: String) extends Person(name2){}
defined class Man
scala> val m = new Man("bluejoe")
m: Man = Man@5ae63954
scala> m.name2
res3: String = bluejoe
scala> m.name
res4: String = bluejoe
scala> m.setName("alex")
scala> m.name2
res6: String = bluejoe
scala>
+++++++++++++++++++++++++++++++++++++++++++
如本文存在任何侵权部分,请及时告知,我会第一时间删除!
转载本博客原创文章,请附上原文@cnblogs的网址!
QQ: 5854165 我的开源项目 欢迎大家一起交流编程架构技术&大数据技术! +++++++++++++++++++++++++++++++++++++++++++
如本文存在任何侵权部分,请及时告知,我会第一时间删除!
转载本博客原创文章,请附上原文@cnblogs的网址!
QQ: 5854165 我的开源项目 欢迎大家一起交流编程架构技术&大数据技术! +++++++++++++++++++++++++++++++++++++++++++