当前位置:网站首页>kotlin 继承
kotlin 继承
2022-07-04 18:32: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("孙晓辉", 20, "Beijing")
g2p.say()
}
边栏推荐
- BCG 使用之CBCGPTabWnd控件(相当于MFC TabControl)
- 1009 Product of Polynomials(25 分)(PAT甲级)
- An example of multi module collaboration based on NCF
- @transactional滥用导致数据源连接池耗尽问题
- . Net ORM framework hisql practice - Chapter 2 - using hisql to realize menu management (add, delete, modify and check)
- 在线文本行固定长度填充工具
- 线上数据库迁移的几种方法
- 欧拉函数
- 黑马程序员-软件测试--07阶段2-linux和数据库-09-24-linux命令学习步骤,通配符,绝对路径,相对路径,文件和目录常用命令,文件内容相关操作,查看日志文件,ping命令使用,
- Online data migration scheme encountered in the project 1 - general idea sorting and technical sorting
猜你喜欢
如何使用Async-Awati异步任务处理代替BackgroundWorker?
The 300th weekly match of leetcode (20220703)
BCG 使用之新建向导效果
【问题】druid报异常sql injection violation, part alway true condition not allow 解决方案
HMM隐马尔可夫模型最详细讲解与代码实现
黑马程序员-软件测试--09阶段2-linux和数据库-31-43修改文件权限字母发的说明,-查找链接修改文件,查找文件命令,链接文件,压缩解压方式,vi编辑器基本使用,
The explain statement in MySQL queries whether SQL is indexed, and several types in extra collate and summarize
Several methods of online database migration
TCP两次挥手,你见过吗?那四次握手呢?
FPGA时序约束分享01_四大步骤简述
随机推荐
FTP, SFTP file transfer
The explain statement in MySQL queries whether SQL is indexed, and several types in extra collate and summarize
mysql中explain语句查询sql是否走索引,extra中的几种类型整理汇总
矩阵翻转(数组模拟)
"Only one trip", active recommendation and exploration of community installation and maintenance tasks
YOLOv5s-ShuffleNetV2
指定输出的字符集
1003 Emergency(25 分)(PAT甲级)
Explicit random number
SSRS筛选器的IN运算(即包含于)用法
JVM系列之对象的创建
Educational Codeforces Round 22 E. Army Creation
socket编程demo二
How test engineers "attack the city" (Part I)
node_exporter部署
用实际例子详细探究OpenCV的轮廓绘制函数drawContours()
PointNeXt:通过改进的模型训练和缩放策略审视PointNet++
Hough transform Hough transform principle
HDU 6440 2018中国大学生程序设计网络选拔赛
Lenovo explains in detail the green smart city digital twin platform for the first time to solve the difficulties of urban dual carbon upgrading