zoukankan
html css js c++ java
抽象类
类中有抽象的方法,此类即为抽象类,抽象方法必须在子类中被重写
using
System;
using
System.Collections.Generic;
using
System.Text;
namespace
ConsoleApplication10
{
class
Program
{
static
void
Main(
string
[] args)
{
HR a
=
new
HR();
Sales b
=
new
Sales();
manger c
=
new
manger();
string
d
=
Console.ReadLine();
if
(d
==
"
HR
"
)
{
a.pay();
Console.ReadKey();
}
if
(d
==
"
Sales
"
)
{
b.pay();
Console.ReadKey();
}
if
(d
==
"
manger
"
)
{
c.pay();
Console.ReadKey();
}
}
}
public
abstract
class
user
{
public
abstract
void
pay();
}
public
class
HR:user
{
public
override
void
pay()
{
Console.WriteLine(
"
4000
"
);
}
}
public
class
Sales : user
{
public
override
void
pay()
{
Console.WriteLine(
"
2000
"
) ;
}
}
public
class
manger : user
{
public
override
void
pay()
{
Console.WriteLine(
"
10000
"
);
}
}
}
肩负责任,永不退缩
查看全文
相关阅读:
《重构》读书笔记
每周总结
《修改代码的艺术》读书笔记
每周总结
每周总结
《修改代码的艺术》读书笔记
每周总结
第二周周总结
以淘宝网为例,描绘质量属性的六个常见属性场景
机器学习第八讲
原文地址:https://www.cnblogs.com/ATP/p/860637.html
最新文章
设计模式的产生背景和重要性
设计模式
Ajax
SpringMVC
spring-web
P7610 [THUPC2021] 群星连结
P5660 [CSP-J2019] 数字游戏
git使用每次输入密码问题
unity简单http案例 + 服务端
UniTask Provides an efficient allocation free async/await integration for Unity.
热门文章
Rider设置代码换行格式
UGUI优化方案之 SetActive 和 CanvasGroup
开源免费商用字体
Unity UGUI源码 URP源码 地址
《Unity3D高级编程之进阶主程》 (也是一个非常不错的博客)
像素游戏Unity工程设置 2D Pixel Perfect:如何为复古的8位游戏设置Unity项目
万人同屏 角色动画优化 Animation Instancing动画实例化– SkinnedMeshRenderer的实例化 GPU Instancing
每周总结
《重构》读书笔记
每周总结
Copyright © 2011-2022 走看看