当前位置:网站首页>Class inheritance in yyds dry inventory C
Class inheritance in yyds dry inventory C
2022-07-06 04:49:00 【Andy ahui】
Welcome to be my reader , I hope this article can give you some help .
Preface
In daily program coding work , Our ultimate goal is to complete the development tasks assigned by the company , The core goal is to write good code .
So what is good code ?
High cohesion , Low coupling
We must be engaged in coding , I've almost heard this sentence . So what kind of code is highly cohesive , How about low coupling .
Today, let's learn about C# In this high-level language , Through those forms .
In current high-level languages , These three characteristics are common , It is also often used in our daily coding . Namely encapsulation 、 Inherit 、 polymorphic .
Let's first look at inheritance
Class inheritance
Through inheritance, we can get a new class , The new class can define a series of methods and variables by itself , It also has the properties and behaviors of the base class .
The relationship here is base class and derived class .
It should be noted that derived classes cannot delete any members of the base class .
The above example ,InfoBase It belongs to the base class ,Ahui It belongs to a derived class , You can see that inheritance is achieved by colons .
Inherited members can be accessed , Just as they are declared by the derived class itself .
Currently, all classes are derived from object class ,object Class is the only non derived class , It is the basis of inheritance hierarchy . Classes that currently have no base class specification are implicitly derived directly from classes object.
matters needing attention
1、 There can only be one separate class in the base class specification of a class declaration , It is called single inheritance .
2、 Although a class can only directly inherit one base class , But there is no limit to the level of inheritance .
At present, derived classes cannot delete members and functions of base classes , But you can shield base class members and functions by declaring the same members in derived classes . Note here that the names must be the same .

remarks
Life is short , I don't want to pursue what I can't see , I just want to catch what I can see .
Originality is not easy. , Pay attention .
I am a A Hui , Thank you for reading , If it helps you , Please like it 、 forward thank you .
I'm glad to be friends with you .
边栏推荐
- word封面下划线
- Unity screen coordinates ugui coordinates world coordinates conversion between three coordinate systems
- Etcd database source code analysis -- etcdserver bootstrap initialization storage
- ISP learning (2)
- Bill Gates posted his 18-year-old resume and expected an annual salary of $12000 48 years ago
- 内核判断i2c地址上是否挂载外设
- Lagrange polynomial
- 程序员在互联网行业的地位 | 每日趣闻
- Scala function advanced
- Raspberry pie 3.5-inch white screen display connection
猜你喜欢

Redis - redis in action - redis actual combat - actual combat Chapter 1 - SMS login function based on redis - redis + token shared session application - with code

Application of Flody
![[05-1, 05-02, 05-03] network protocol](/img/25/2e9ccc3f31a1fd46c9ab643d48064b.jpg)
[05-1, 05-02, 05-03] network protocol
![[lgr-109] Luogu may race II & windy round 6](/img/fe/d5b67c7dff759c519a04da023630ea.png)
[lgr-109] Luogu may race II & windy round 6

Postman关联

从0到1建设智能灰度数据体系:以vivo游戏中心为例

canal同步mysql数据变化到kafka(centos部署)

Dry goods collection | Vulkan game engine video tutorial

Zynq learning notes (3) - partial reconfiguration

Distributed transaction solution
随机推荐
Lepton 无损压缩原理及性能分析
[buuctf.reverse] 159_[watevrCTF 2019]Watshell
2021 robocom world robot developer competition - undergraduate group (semi-finals)
word封面下划线
比尔·盖茨晒18岁个人简历,48年前期望年薪1.2万美元
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Visio draws Tai Chi
MPLS experiment
ue5 小知识点 开启lumen的设置
饼干(考试版)
Postman前置脚本-全局变量和环境变量
团队协作出了问题,项目经理怎么办?
C'est un petit résumé de l'étude.
SQL注入漏洞(MSSQL注入)
Acwing week 58
[buuctf.reverse] 159_ [watevrCTF 2019]Watshell
English Vocabulary - life scene memory method
Tengine kernel parameters
Upload nestjs configuration files, configure the use of middleware and pipelines
The kernel determines whether peripherals are attached to the I2C address