是对多态性的完全定义吗? [英] IS the complete defination for Polymorphism....?

查看:84
本文介绍了是对多态性的完全定义吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当子类继承自父类并获得父类的所有方法属性时.
要解决此问题,父类的类成员必须将父类声明为虚拟,而子类应声明为重写..
这整个过程称为多态性

是多态的完整定义吗?...?

When child class inherits from a parent class and it gains all the methods properties of the parent class.
To resolve this problem a class member from a parent class, the parent class has to be declare as virtual while the child class should declare as override..
this whole process is called polymorphism

IS the complete defination for Polymorphism....?

推荐答案

不,这不是多态的定义.
这是继承.

多态性的字面意思是许多形式".
多态是创建具有多种形式的对象或方法的能力.

多态性背后的想法是让所有用户选择他们想要在运行时而不是设计时使用的方法.
方法重载和重载本身并不是多态性的真正例子.
No this is not the definition of Polymorphism.
This is Inheritance.

Polymorphism literally mean "many forms".
Polymorphism is the ability to create an object or a method that can have more than one form.

The idea behind polymorphism is to all the user to choose what method they want to use at runtime than at design time.
Method overloading and overriding are not really examples of Polymorphism by themselves.


这里有一个很好的例子解释:
Here''s one quite nice explanation with examples: Polymorphism (C# Programming Guide)[^]


请看下面的CodeProject文章链接.

本文将为您提供有关面向对象编程概念的详细信息.
什么是多态?
Have a look at below CodeProject Article link.

This article will give you details arould Object Oriented Programming Concepts.
What is Polymorphisms?


这篇关于是对多态性的完全定义吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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