当前位置:网站首页>Matters of parent-child class construction method in inheritance
Matters of parent-child class construction method in inheritance
2022-06-12 22:56:00 【I met you too】
Matters of parent-child class construction method in inheritance
1、 In an inheritance relationship , The subclass must call the constructor of the parent class , There is an implicit in the subclass constructor “super()” call , So you must call the constructor of the parent class first , Construction of post execution subclass .
Be careful super() Is the parameterless constructor of the parent class of the call .
Public Zi(){
super();// Default implies , If you don't write, there will be
sout:" Subclass construction method ";
}
2、 Subclass construction can be done by super Keyword calls the parent class overload constructor
3、 Only child class constructors can call parent class constructors
4、super() The parent class construct of calls , Must be the first statement of subclass construction .
5、 A subclass construct cannot be called more than once super() structure .
边栏推荐
- 【LeetCode】209. 长度最小的子数组
- China's alternative sports equipment market trend report, technology dynamic innovation and market forecast
- 认识的几位清华同学都离职了……
- Research and Analysis on the development of China's Melamine Industry from 2022 to 2028 and market prospect forecast report
- Mysql case when then函数使用
- 基于51单片机的酒精检测仪
- QT quick 3D learning: use mouse and keyboard to control node position and direction
- JVM Basics - > how to troubleshoot JVM problems in your project
- What you must know about cloud computing
- China's new generation information technology industry "14th five year plan" special planning and innovation strategic direction report 2022 ~ 2028
猜你喜欢

ShardingSphere-proxy-5.0.0部署之分表实现(一)

【建议收藏】通俗易懂图解网络知识-第一篇

JVM foundation - > talk about class loader two parent delegation model

web3 原则和去中心化

度量学习(Metric Learning)【AMSoftmax、Arcface】

Gb28181 protocol -- alarm

JVM foundation > CMS garbage collector

QT quick 3D learning: mouse picking up objects

Photoshop:PS如何实现放大图片不模糊
![[recommended collection] easy to understand graphic network knowledge - Part 1](/img/5a/dc9f1fd6cfdc1350f757b70e368fe3.png)
[recommended collection] easy to understand graphic network knowledge - Part 1
随机推荐
iShot
在同花顺开户证券安全吗,买股票怎么网上开户
[leetcode] the k-largest element in the array
The "fourteenth five year plan" development plan and panoramic strategic analysis report of China's information and innovation industry 2022 ~ 2028
Is it safe to open an account for flush stock account
JVM Basics - > What are the thread shared areas in the JVM
Mysql case when then函数使用
Research Report on market supply and demand and strategy of tizanidine industry in China
42岁大厂高管,给30岁-39岁人提个醒:这6个让你变强的习惯,要尽快养成
基于51单片机的酒精检测仪
Qrcodejs2 QR code generation JS
OpenCV源代码编译
China's new generation information technology industry "14th five year plan" special planning and innovation strategic direction report 2022 ~ 2028
Analysis report on business model innovation path and operation status of China's app store industry from 2022 to 2028
JVM foundation - > talk about class loader two parent delegation model
【LeetCode】102. 二叉树的层序遍历
flutter系列之:flutter中常用的GridView layout详解
Go time format assignment
深度学习-神经网络:卷积的实现方法【直接法(精度没损失)、GEMM(矩阵乘法,精度没损失)、FFT(傅里叶变换,精度有损失)、Winograd(精度有损失)】
Module 8 operation