静态多态是多态吗?以坚实的理由支持您的答案 [英] Is static polymorphism is polymorphism? Support your answer with solid reasons

查看:97
本文介绍了静态多态是多态吗?以坚实的理由支持您的答案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

静态多态是多态吗?用坚实的理由支持你的答案

Is static polymorphism is polymorphism? Support your answer with solid reasons

推荐答案

我们不做你的功课:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!


多态这个词意味着有很多形式。在面向对象的编程范例中,多态通常表示为一个接口,多个函数。



多态可以是静态的或动态的。



在静态多态性中,对函数的响应在编译时确定。



在动态多态中,它是在运行时决定的。



静态多态性

在编译期间将函数与对象链接的机制称为早期绑定。它也称为静态绑定。 C#提供了两种实现静态多态的技术。这些是:



功能超载



运营商超载



动态多态性



C#允许您创建用于提供接口的部分类实现的抽象类。当派生类继承它时,实现完成。抽象类包含抽象方法,这些方法由派生类实现。派生类具有更专业的功能。



请注意以下关于抽象类的规则:



你无法创建抽象类的实例



您不能在抽象类之外声明抽象方法



当一个类被声明为密封时,它不能被继承,抽象类不能被声明为密封。



请阅读以下文章中的示例。



C# - 多态性
The word polymorphism means having many forms. In object-oriented programming paradigm, polymorphism is often expressed as 'one interface, multiple functions'.

Polymorphism can be static or dynamic.

In static polymorphism the response to a function is determined at the compile time.

In dynamic polymorphism , it is decided at run-time.

Static Polymorphism
The mechanism of linking a function with an object during compile time is called early binding. It is also called static binding. C# provides two techniques to implement static polymorphism. These are:

Function overloading

Operator overloading

Dynamic Polymorphism

C# allows you to create abstract classes that are used to provide partial class implementation of an interface. Implementation is completed when a derived class inherits from it. Abstract classes contain abstract methods, which are implemented by the derived class. The derived classes have more specialized functionality.

Please note the following rules about abstract classes:

You cannot create an instance of an abstract class

You cannot declare an abstract method outside an abstract class

When a class is declared sealed, it cannot be inherited, abstract classes cannot be declared sealed.

Please read below article for the examples.

C# - Polymorphism


这篇关于静态多态是多态吗?以坚实的理由支持您的答案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆