当前位置:网站首页>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()
}
边栏推荐
- kotlin 条件控制
- Oracle with as ora-00903: invalid table name multi report error
- 添加命名空间声明
- Multi table operation inner join query
- FPGA时序约束分享01_四大步骤简述
- Reflection (I)
- 1002. A+b for Polynomials (25) (PAT class a)
- 1003 emergency (25 points) (PAT class a)
- Educational Codeforces Round 22 E. Army Creation
- HDU 1097 A hard puzzle
猜你喜欢
Niuke Xiaobai month race 7 who is the divine Archer
English grammar_ Noun - use
Oracle with as ora-00903: invalid table name multi report error
“只跑一趟”,小区装维任务主动推荐探索
92. (cesium chapter) cesium building layering
Lenovo explains in detail the green smart city digital twin platform for the first time to solve the difficulties of urban dual carbon upgrading
一文掌握数仓中auto analyze的使用
Online text line fixed length fill tool
English语法_名词 - 使用
Several methods of online database migration
随机推荐
HDU 6440 2018中国大学生程序设计网络选拔赛
生成XML元素
Oracle with as ora-00903: invalid table name multi report error
abc229 总结(区间最长连续字符 图的联通分量计数)
1008 Elevator(20 分)(PAT甲级)
HMM隐马尔可夫模型最详细讲解与代码实现
socket编程demo二
联想首次详解绿色智城数字孪生平台 破解城市双碳升级难点
有关架构设计的个人思考(本文后续不断修改更新)
Several methods of online database migration
Shell 编程核心技术《三》
Crawler (6) - Web page data parsing (2) | the use of beautifulsoup4 in Crawlers
FPGA timing constraint sharing 01_ Brief description of the four steps
Siemens HMI download prompts lack of panel image solution
Multi table operation inner join query
Educational Codeforces Round 22 E. Army Creation
1009 product of polynomials (25 points) (PAT class a)
1009 Product of Polynomials(25 分)(PAT甲级)
Opencv functions and methods related to binary threshold processing are summarized for comparison and use
在线文本行固定长度填充工具