class Student(var name:String,private var age:Int,protected var height:Int) {
def say(): Unit = {
println(s"s${this.age}")
}
}
class Major(name:String, age:Int, height:Int) extends Student(name,age,height){
this.age
super.
}
def main(args: Array[String]): Unit = {
val s1 = new Student("小花",18)
s1.say()
class Student(var name:String,private var age:Int,protected var weight:Int) {
def say(): Unit = {
println(s"s${this.age},${weight}")
}
private def sayAge(): Unit = {
println(age)
}
protected def sayWeight(): Unit = {
println(weight)
}
object Student {...}
class Major(name:String, age:Int, height:Int) extends Student(name,age,height){
sayWeight()