摘要: 题目描述 根据给出代码,补写缺失代码,当print函数内为整数的时候,输出整数的三次方,为浮点数,输出其二次方,为字符串时,直接输出。 using System; namespace PolymorphismApplication { class Printdata { /************* 阅读全文
posted @ 2020-04-02 13:16 青衫客36 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 题目描述 接口实例。接口和类如下图所示,根据给出代码,补写缺失的代码,然后在Program类的静态Main方法中验证所实现的类。 using System; namespace Myinterface { public interface IShape { double Perimeter(); d 阅读全文
posted @ 2020-04-02 13:11 青衫客36 阅读(390) 评论(0) 推荐(0) 编辑
摘要: 题目描述 程序由两部分组成,如下代码所示。第一部分定义了委托、类和事件。第二部分进行验证。 using System; namespace HelloWorldApplication { public delegate void DelegateRing(); public class Bell{ 阅读全文
posted @ 2020-04-02 13:07 青衫客36 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 题目描述 根据给出的代码,补全缺失的代码,输入两个数字为长方形的长和宽,从而得出长方形的面积。 using System;namespace InheritanceApplication{ class Shape { public void setWidth(int w) { width = w; 阅读全文
posted @ 2020-04-02 12:41 青衫客36 阅读(663) 评论(0) 推荐(0) 编辑
摘要: 题目描述 编写代码实现:定义了三个类Bird、Mapie、Eagle。其中Bird为抽象类,定义了一个抽象方法Eat()。Mapie类和Eagle类为Bird的派生类。Mapie类中重写了Eat()方法,重载了一个Eat(int time)方法。Eagle类中也重写了Eat()方法。 输入 输入ti 阅读全文
posted @ 2020-04-02 12:32 青衫客36 阅读(285) 评论(0) 推荐(0) 编辑
摘要: 题目描述 一、定义一个抽象类Vehicles,具体要求如下: 1、私有字段商标brand(string)、颜色color(string)。 2、定义公有读写属性Brand用来访问brand字段;定义公有读写属性Color用来访问color字段。 3、设计一个抽象虚方法run()。 二、定义Vehic 阅读全文
posted @ 2020-04-02 12:21 青衫客36 阅读(372) 评论(0) 推荐(0) 编辑