当前位置:网站首页>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
边栏推荐
- Introduction to GUI programming to game practice (I)
- Gd32f3x0 official PWM drive has a small positive bandwidth (inaccurate timing)
- Serious hazard warning! Log4j execution vulnerability is exposed!
- Daily production training report (15)
- Vie procédurale
- Introduction to lcm32f037 series of MCU chip for motor
- Leetcode513. Find the value in the lower left corner of the tree
- A beginner's entry is enough: develop mobile IM from zero
- Mongodb image configuration method
- Internship May 29, 2019
猜你喜欢
Introduction to GUI programming to game practice (I)
Installation and deployment of alluxio
[upsampling method opencv interpolation]
[arm] build boa based embedded web server on nuc977
apktool 工具使用文档
cartographer_ backend_ constraint
Classic theory: detailed explanation of three handshakes and four waves of TCP protocol
There are applications related to web network request API in MATLAB (under update)
Leetcode513.找出树的左下角的值
cartographer_ pose_ graph_ 2d
随机推荐
AutowiredAnnotationBeanPostProcessor什么时候被实例化的?
Recursively traverse directory structure and tree presentation
《财富自由之路》读书之一点体会
FindControl的源代码
12 multithreading
使用Jedis监听Redis Stream 实现消息队列功能
基于SDN的DDoS攻击缓解
Redis installation on Linux
MySQL source code reading (II) login connection debugging
Command line interface of alluxio
LeetCode_ Binary search tree_ Simple_ 108. convert an ordered array to a binary search tree
线程优先级
cartographer_backend_constraint
Supplementary course on basic knowledge of IM development (II): how to design a server-side storage architecture for a large number of image files?
9 common classes
Redis discovery bloom filter
data = self._data_queue.get(timeout=timeout)
Navicat如何将当前连接信息复用另一台电脑
自定义WebSerivce作为代理解决SilverLight跨域调用WebService问题
How to select the data transmission format of instant messaging application