列表不同的实现是多态吗?

huangapple go评论77阅读模式
英文:

Is list different implementation a polymorphism?

问题

List arrayList = new ArrayList<>();

List linkedList = new LinkedList<>();

这两个对象都是List,但实现方式不同。
这算是在调用多态吗?

英文:
List &lt;String&gt; arrayList = new ArrayList&lt;&gt;(); 

List &lt;String&gt; linkedList = new LinkedList&lt;&gt;();

Two these objects gives List, but the implementation is different.
Is it calling a polymorphism?

答案1

得分: 2

是的,这被称为子类型多态性

它是“多态性”这一总体概念的几种类型之一。

英文:

Yes, this is called subtype polymorphism.

It is one of the several types of the general concept of "polymorphism."

huangapple
  • 本文由 发表于 2020年4月10日 18:53:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/61138792.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定