2015年9月8日
摘要:
package com.leegh.parameterization/** * @author Guohui Li */class Self { self => val tmp = "Scala" def foo = self.tmp + this.tmp}trait S1class S2 {...
阅读全文
posted @ 2015-09-08 09:01
李格非
阅读(239)
推荐(0)
2015年9月7日
摘要:
package com.leegh.parameterization/** * @author Guohui Li */object Infix_Types { def main(args: Array[String]): Unit = { object Log { def >>:(data...
阅读全文
posted @ 2015-09-07 14:44
李格非
阅读(144)
推荐(0)
2015年9月6日
摘要:
package com.leegh.parameterizationimport com.leegh.parameterization.Compound_Type/** * @author Guohui Li */trait Compound_Type1;trait Compound_Type2;c...
阅读全文
posted @ 2015-09-06 07:44
李格非
阅读(130)
推荐(0)
2015年9月5日
摘要:
package com.leegh.parameterization/** * @author Guohui Li */class Structural { def open() = print("A class instance Opened") }object Structural_Type {...
阅读全文
posted @ 2015-09-05 09:00
李格非
阅读(135)
推荐(0)
2015年9月4日
摘要:
package com.leegh.parameterization/** * @author Guohui Li */class Outer { private val x = 10 class Inner { private val y = x + 10 }}object Path_...
阅读全文
posted @ 2015-09-04 08:36
李格非
阅读(141)
推荐(0)
2015年9月3日
摘要:
package com.leegh.parameterization/** * @author Guohui Li *///由于breathe返回的是this,scala将返回类型推断为Animal,而由于Animal没有eat方法//class Animal { def breathe = thi...
阅读全文
posted @ 2015-09-03 13:30
李格非
阅读(154)
推荐(0)
2015年9月2日
摘要:
package com.leegh.parameterization/** * @author Guohui Li */class Personclass Student extends Personclass C[+T](val args: T)trait Friend[-T] { def ma...
阅读全文
posted @ 2015-09-02 08:55
李格非
阅读(142)
推荐(0)
2015年9月1日
摘要:
package com.leegh.parameterization/** * @author Guohui Li */object Type_Contraints { def main(args: Array[String]): Unit = { def rocky[T](i: T)(im...
阅读全文
posted @ 2015-09-01 08:54
李格非
阅读(151)
推荐(0)
2015年8月31日
摘要:
package com.leegh.parameterization/** * @author Guohui Li */class M_A[T]class M_B[T]object Multiple_Bounds { def main(args: Array[String]): Unit = { ...
阅读全文
posted @ 2015-08-31 10:26
李格非
阅读(113)
推荐(0)
2015年8月30日
摘要:
package com.leegh.parameterizationimport scala.reflect.ClassTag/** * @author Guohui Li */class A[T]object Manifest_ClassTag { def main(args: Array[St...
阅读全文
posted @ 2015-08-30 11:12
李格非
阅读(615)
推荐(0)