我可以像这样定义多态性吗? [英] Can I define Polymorphism like this.

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

问题描述

我最近在OOP中理解了多态性的概念。所以,我用自己的语言定义了它,但想问它是否正确。我们都知道没有定义是绝对正确的。



多态性可以定义为类的实例之间的公共接口,但每个实例的特征可以变化,保持接口相同。



:)

解决方案

概念 - 更多说理论 - 多态性 [ ^ ]定义明确(包括OOP),并没有太多争论。差异可能来自不同语言的不同级别/类型的实现...

您的短语告诉我您只接受计数虚拟方法 - 这只是一种多态...

I have recently understood the concept of Polymorphism in OOP. So, I defined it in my own words but wanted to ask that "Is it correct". We all know that no definition can be absolutely correct.

Polymorphism can be defined as "Common Interface among instances of classes but traits for each instance can vary keeping the interface same".

:)

解决方案

The concept - more to say theory - of polymorphism[^] in CS is well defined (including OOP) and there is not much to debate about. The differences may come from different level/type of implementation in different languages...
Your phrase shows me that you only take in count virtual methods - that's only one kind of polymorphism...


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

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