当前位置:网站首页>C#关于抽象类的学习
C#关于抽象类的学习
2022-06-09 20:25:00 【charlsdm】
下边代码涵盖了抽象类学习的案例
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3
{
abstract class Fruits
{
public string name;
public abstract void Bad();
public virtual void Test()
{
}
}
class Apple : Fruits
{
public override void Bad()
{
Console.WriteLine("苹果已经烂掉了");
}
}
class SuperApple:Apple
{
public override void Bad()
{
Console.WriteLine("超级苹果已经烂掉了");
}
public override void Test()
{
Console.WriteLine("超级苹果Test");
}
}
class Program
{
static void Main(string[] args)
{
Fruits fruits = new Apple();
fruits.Bad();
Fruits myfruits = new SuperApple();
myfruits.Test();
}
}
}
边栏推荐
- ConvNets Principles
- Leetcode 1984. Minimum difference in student scores (yes, resolved)
- 牛客网:关于第K个数的一些排序问题
- Modelarts second training notes
- Kalman filter (KF) unscented Kalman filter (UKF)
- Win7 64 bit ultimate installation office2003 prompt: "error 1919, error occurred when configuring ODBC data source MS Access database ODEC error"
- HMI 串口屏 SD卡/TF卡升级的 bug
- HMI 创建工程生成字库的一个潜在bug
- C#中委托与事件之间的一些应用
- Niuke network: some sorting problems about the k-th number
猜你喜欢

After 1995, programmers in big factories were sentenced to 9 months for deleting databases

ClickHouse 数据插入、更新与删除操作 SQL

Detailed explanation of uboot

< collection > and < Association > labels

Alibaba cloud 22q1 status summary, where are you going

Leetcode stack and queue
![[opencvsharpdnn] implementation example of yolov3 and Caffe in opencvsharp](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[opencvsharpdnn] implementation example of yolov3 and Caffe in opencvsharp

Paramiko and thread pool demo (fast batch operation server)

目标分割之--Unet对多类别数据集的语义分割
How to query the database with eloquent in laravel (select)
随机推荐
Discussion on mobx
C#中委托与事件之间的一些应用
Official announcement! Broadcom will acquire VMware with us $61billion and assume US $8billion in debt
Drink at night, 50 classic SQL questions, really fragrant~
护网面试(杂)
Tidb single machine and cluster environment installation, single machine rapid experience
[MySQL] principle and construction of master-slave replication
Anlu technology released new SF1 series fpsoc products: high integration and low power consumption, helping to realize a variety of application scenarios
paramiko和线程池Demo(快速批量操作服务器)
自动更新域名解析到本机IP,DDNS
NoSQL redis configuration and optimization (I blew the night breeze of Qinhuai River for you when you were not in Nanjing)
MySQL data type
安路科技发布SF1系列FPSoC新品:高集成低功耗,助力实现多种应用场景
Question bank and answers for the 2022 National latest fire facility operator (senior fire facility operator) examination
ClickHouse 数据插入、更新与删除操作 SQL
Personal blog system (with source code)
Bug in upgrading SD card / TF card of HMI serial interface screen
查询sql
C#中的里氏替换原则
将excel中的合并单元格拆分并填充数据