当前位置:网站首页>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 .
边栏推荐
- [buuctf.reverse] 159_ [watevrCTF 2019]Watshell
- How to estimate the population with samples? (mean, variance, standard deviation)
- SQL注入漏洞(MSSQL注入)
- A little knowledge of CPU, disk and memory
- Visio draw fan
- Etcd database source code analysis -- etcdserver bootstrap initialization storage
- 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
- Dry goods collection | Vulkan game engine video tutorial
- Orm-f & Q object
- Can Flink SQL read multiple topics at the same time. How to write in with
猜你喜欢
Crazy God said redis notes
Postman pre script - global variables and environment variables
ORM aggregate query and native database operation
Visio draw fan
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
8. Static file
Is the mode of education together - on campus + off campus reliable
比尔·盖茨晒18岁个人简历,48年前期望年薪1.2万美元
Postman Association
麥斯克電子IPO被終止:曾擬募資8億 河南資產是股東
随机推荐
MIT CMS. 300 session 8 – immersion / immersion
[05-1, 05-02, 05-03] network protocol
Postman pre script - global variables and environment variables
力扣(LeetCode)186. 翻转字符串里的单词 II(2022.07.05)
Biscuits (examination version)
Orm-f & Q object
yolov5 tensorrt加速
word封面下划线
也算是学习中的小总结
The implementation of the maize negotiable digital warehouse receipt standard will speed up the asset digitization process of the industry
Redis 排查大 key 的4种方法,优化必备
最高法院,离婚案件判决标准
Can Flink SQL read multiple topics at the same time. How to write in with
从0到1建设智能灰度数据体系:以vivo游戏中心为例
Summary of redis AOF and RDB knowledge points
程序员在互联网行业的地位 | 每日趣闻
SQL injection vulnerability (MSSQL injection)
Sqlserver query results are not displayed in tabular form. How to modify them
win10电脑系统里的视频不显示缩略图
MPLS experiment