当前位置:网站首页>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()
}
边栏推荐
- SSRS筛选器的IN运算(即包含于)用法
- Stream流
- The page element is vertically and horizontally centered, realizing the vertical and horizontal centering of known or unknown width.
- 如何使用Async-Awati异步任務處理代替BackgroundWorker?
- Explicit random number
- 黑马程序员-软件测试--09阶段2-linux和数据库-31-43修改文件权限字母发的说明,-查找链接修改文件,查找文件命令,链接文件,压缩解压方式,vi编辑器基本使用,
- 求2的n次方
- kotlin 基本使用
- BCG 使用之CBCGPProgressDlg进度条使用
- Siemens HMI download prompts lack of panel image solution
猜你喜欢

The 300th weekly match of leetcode (20220703)

Lm10 cosine wave homeopathic grid strategy

Upgrade the smart switch, how much is the difference between the "zero fire version" and "single fire" wiring methods?

"Only one trip", active recommendation and exploration of community installation and maintenance tasks

English grammar_ Noun - use

TCP两次挥手,你见过吗?那四次握手呢?

Hough transform Hough transform principle

Online sql to excel (xls/xlsx) tool

Swagger突然发癫

C # use stopwatch to measure the running time of the program
随机推荐
Multi table operation - external connection query
牛客小白月赛7 I 新建 Microsoft Office Word 文档
西门子HMI下载时提示缺少面板映像解决方案
大div中有多个div,这些div在同一行显示,溢出后产生滚动条而不换行
Online data migration scheme encountered in the project 1 - general idea sorting and technical sorting
1003 Emergency(25 分)(PAT甲级)
牛客小白月赛7 E Applese的超能力
Shell 编程核心技术《四》
BCG 使用之CBCGPTabWnd控件(相当于MFC TabControl)
1002. A+B for Polynomials (25)(PAT甲级)
一文掌握数仓中auto analyze的使用
An example of multi module collaboration based on NCF
Crawler (6) - Web page data parsing (2) | the use of beautifulsoup4 in Crawlers
Generate XML elements
多表操作-外连接查询
HDU 1372 & POJ 2243 Knight moves (breadth first search)
Introduction to polyfit software
FPGA timing constraint sharing 01_ Brief description of the four steps
Stream流
. Net ORM framework hisql practice - Chapter 2 - using hisql to realize menu management (add, delete, modify and check)