当前位置:网站首页>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()
}
边栏推荐
- There are multiple divs in the large div, which are displayed on the same line. After overflow, scroll bars are generated without line breaks
- 一文掌握数仓中auto analyze的使用
- 1002. A+B for Polynomials (25)(PAT甲级)
- 明明的随机数
- 《工作、消费主义和新穷人》的微信读书笔记
- The page element is vertically and horizontally centered, realizing the vertical and horizontal centering of known or unknown width.
- Lenovo explains in detail the green smart city digital twin platform for the first time to solve the difficulties of urban dual carbon upgrading
- Leetcode ransom letter C # answer
- 如何使用Async-Awati异步任务处理代替BackgroundWorker?
- BCG 使用之CBCGPProgressDlgCtrl进度条使用
猜你喜欢
node_ Exporter deployment
与二值化阈值处理相关的OpenCV函数、方法汇总,便于对比和拿来使用
92.(cesium篇)cesium楼栋分层
LM10丨余弦波动顺势网格策略
Euler function
"Only one trip", active recommendation and exploration of community installation and maintenance tasks
Opencv functions and methods related to binary threshold processing are summarized for comparison and use
Oracle with as ORA-00903: invalid table name 多表报错
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?
随机推荐
Socket programming demo II
C# 使用StopWatch测量程序运行时间
矩阵翻转(数组模拟)
English语法_名词 - 使用
node_ Exporter deployment
Double colon function operator and namespace explanation
页面元素垂直水平居中、实现已知或者未知宽度的垂直水平居中。
. Net ORM framework hisql practice - Chapter 2 - using hisql to realize menu management (add, delete, modify and check)
26. Delete the duplicate item C solution in the ordered array
Specify the character set to output
MySQL数据库基本操作-DDL | 黑马程序员
Unity editor extends C to traverse all pictures in folders and subdirectories
Pointnet/Pointnet++点云数据集处理并训练
Generate XML elements
BCG 使用之CBCGPProgressDlg进度条使用
测试工程师如何“攻城”(上)
HDU 6440 2018中国大学生程序设计网络选拔赛
生成XML元素
勾股数规律(任意三个数能够满足勾股定理需要满足的条件)
Oracle with as ora-00903: invalid table name multi report error