作者rick1014 (hi)
看板java
標題[問題] 請問covariant是什麼意思?
時間Thu Apr 2 16:12:03 2009
The problem is that arrays are covariant, so a List<String>[] is also an
Object[], and you can use this to assign an ArrayList<Integer> into your
array, with no error at either compile time or run time.
雖然這句話我大概了解是什麼意思,
不過不非常清楚covarint是泛指什麼意思,
是後半段,is-a 又為is-b的關係就是covarint的意思嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.241.106.154
※ 編輯: rick1014 來自: 210.241.106.154 (04/02 16:22)
推 adrianshum:有前後文嘛? 通常 convariant都是在說 is-a 之類的東西 04/02 16:43
※ 編輯: rick1014 來自: 210.241.106.154 (04/02 17:07)
推 H45:之前 PLT 看板有一大串在講 covariant... 04/03 01:13