討論串[問題] Scala上generic和implicit的怪問題
共 2 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓1(1推 0噓 2→)留言3則,0人參與, 最新作者yauhh (喲)時間12年前 (2013/01/15 04:12), 編輯資訊
0
0
0
內容預覽:
三段程式沒有很像啊. 這裏有一個 method `action` of type (arg: TP): TP. 然後 * 不確定是否能夠定義為函數名稱但是這裏跑一個 method `action` 為把 type T 換成 type TP改寫成以下這樣,似乎OK:. abstract class A
(還有268個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者coolcomm (coolcomm)時間12年前 (2013/01/14 11:49), 編輯資訊
0
0
0
內容預覽:
以下是三段很像的程式碼. // (1) implicit def中的implicit val. abstract class Abstract1 {. type TP. protected def action[T <% TP](arg: T): TP. }. class Concrete1(s:
(還有1148個字)
首頁
上一頁
1
下一頁
尾頁