当前位置:网站首页>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()
}
边栏推荐
猜你喜欢

黑马程序员-软件测试--08阶段2-linux和数据库-23-30-进程端口相关,修改文件权限,端口号信息的获取,程序和进程相关操作,linux命令案例

PolyFit软件介绍

92. (cesium chapter) cesium building layering

大div中有多个div,这些div在同一行显示,溢出后产生滚动条而不换行

Bi skills - permission axis

C# 使用StopWatch测量程序运行时间

FPGA时序约束分享01_四大步骤简述

欧拉函数

Stream流

黑马程序员-软件测试--09阶段2-linux和数据库-31-43修改文件权限字母发的说明,-查找链接修改文件,查找文件命令,链接文件,压缩解压方式,vi编辑器基本使用,
随机推荐
Pytest 可视化测试报告之 Allure
BCG 使用之CBCGPProgressDlgCtrl進度條使用
HDU 6440 2018中国大学生程序设计网络选拔赛
Online sql to excel (xls/xlsx) tool
用实际例子详细探究OpenCV的轮廓绘制函数drawContours()
"Only one trip", active recommendation and exploration of community installation and maintenance tasks
Wechat reading notes of "work, consumerism and the new poor"
HDU 6440 2018 Chinese college student program design network competition
Oracle with as ORA-00903: invalid table name 多表报错
如何使用Async-Awati异步任務處理代替BackgroundWorker?
Some thoughts on whether the judgment point is located in the contour
There are multiple divs in the large div, which are displayed on the same line. After overflow, scroll bars are generated without line breaks
矩阵翻转(数组模拟)
Oracle with as ora-00903: invalid table name multi report error
Educational Codeforces Round 22 E. Army Creation
一文掌握数仓中auto analyze的使用
Introduction to polyfit software
1008 Elevator(20 分)(PAT甲级)
Mysql database basic operation -ddl | dark horse programmer
kotlin 条件控制