当前位置:网站首页>About abstact and virtual
About abstact and virtual
2022-06-26 05:29:00 【Elliot_ Alderson】
Study in school C# When , I often skip classes , In addition, the teacher didn't attract my attention very much at that time , For abstract classes abstract and virtual Virtual methods and other things are always not understood , Fortunately, I didn't get much in the final exam .
In a brief summary :
abstract You can declare abstract classes and abstract methods .
Abstract methods can only be declared in abstract classes , And once declared as an abstract method , It cannot be implemented at the time of declaration .
Once an abstract method subclass inherits , Must be realized , Otherwise, it will violate the rules .
virtual Virtual methods can be declared .
Virtual methods can be declared in any class , It can be implemented at the declaration place , And virtual methods cannot be declared as private.
Subclasses can choose whether to override virtual methods or not .
To put it bluntly ,abstract The abstract method of is equal to a necessary condition , If you inherit it, you must do it , and virtual Equal to the optional condition , It doesn't matter whether you do it or not .
OvO
边栏推荐
- Leetcode513. Find the value in the lower left corner of the tree
- Sofa weekly | open source person - Yu Yu, QA this week, contributor this week
- PHP 2D / multidimensional arrays are sorted in ascending and descending order according to the specified key values
- 无线网络存在的安全问题及现代化解决方案
- uniCloud云开发获取小程序用户openid
- How to rewrite a pseudo static URL created by zenpart
- Security problems in wireless networks and modern solutions
- 递归遍历目录结构和树状展现
- [red team] what preparations should be made to join the red team?
- Two step processing of string regular matching to get JSON list
猜你喜欢

红队得分方法统计

Henkel database custom operator '~~‘

Could not get unknown property ‘*‘ for SigningConfig container of type org. gradle. api. internal

How to rewrite a pseudo static URL created by zenpart

Create SSH key pair configuration steps

Wechat team sharing: technical decryption behind wechat's 100 million daily real-time audio and video chats

慢慢学JVM之缓存行和伪共享

百度API地图的标注不是居中显示,而是显示在左上角是怎么回事?已解决!

创建 SSH 秘钥对 配置步骤

cartographer_pose_graph_2d
随机推荐
vscode config
Leetcode513. Find the value in the lower left corner of the tree
Mongodb image configuration method
ECCV 2020 double champion team, take you to conquer target detection on the 7th
最后一次飞翔
劣币驱逐良币的思考
售前分析
Lesson 4 serial port and clock
cartographer_ local_ trajectory_ builder_ 2d
Technical problems to be faced in mobile terminal im development
红队得分方法统计
The difference between get and post in small interview questions
生命原来如此脆弱
Replacing domestic image sources in openwrt for soft routing (take Alibaba cloud as an example)
Apktool tool usage document
cartographer_fast_correlative_scan_matcher_2d分支定界粗匹配
《财富自由之路》读书之一点体会
The wechat team disclosed that the wechat interface is stuck with a super bug "15..." The context of
创建 SSH 秘钥对 配置步骤
Security problems in wireless networks and modern solutions