当前位置:网站首页>Kotlin inheritance
Kotlin inheritance
2022-07-04 19:42:00 【AdleyTales】
open class Student(var name: String, var age: Int) {
open fun say() {
println("name: $name, age: $age, say ------")
}
}
class G2Student(name: String, age: Int, var email : String) : Student(name, age) {
override fun say() {
println("name: $name, age: $age, email: $email, say ------")
}
}
fun main() {
val p =Student("adley", 18)
p.say()
val g2p = G2Student(" Sun Xiaohui ", 20, "Beijing")
g2p.say()
}
边栏推荐
- HDU 6440 2018中国大学生程序设计网络选拔赛
- HDU 6440 2018 Chinese college student program design network competition
- An example of multi module collaboration based on NCF
- Stream流
- Swagger突然发癫
- Detailed explanation of the binary processing function threshold() of opencv
- . Net ORM framework hisql practice - Chapter 2 - using hisql to realize menu management (add, delete, modify and check)
- Shell 編程核心技術《四》
- SSRS筛选器的IN运算(即包含于)用法
- English grammar_ Noun - use
猜你喜欢
随机推荐
矩阵翻转(数组模拟)
Functional interface
Stream流
Hough transform Hough transform principle
HDU 1097 A hard puzzle
The page element is vertically and horizontally centered, realizing the vertical and horizontal centering of known or unknown width.
指定输出的字符集
Shell programming core technology "I"
"Only one trip", active recommendation and exploration of community installation and maintenance tasks
大div中有多个div,这些div在同一行显示,溢出后产生滚动条而不换行
Utilisation de la barre de progression cbcggprogressdlgctrl utilisée par BCG
Master the use of auto analyze in data warehouse
函数式接口
Upgrade the smart switch, how much is the difference between the "zero fire version" and "single fire" wiring methods?
Niuke Xiaobai monthly race 7 I new Microsoft Office Word document
在线文本行固定长度填充工具
Online data migration scheme encountered in the project 1 - general idea sorting and technical sorting
kotlin 类和对象
1006 sign in and sign out (25 points) (PAT class a)
Pytorch学习(四)