标签:
object Test4 extends App { //提取器 object Fac{ def unapply(o:Fac) = Some(o.a,o.b) } class Fac(var a:Int,var b:Int){ def *(o:Fac)=new Fac(a*o.a ,b*o.b) def show=a+","+b; } var Fac(a,b)=new Fac(1,2)*new Fac(2,3); println(a+" , "+ b); }
标签:
原文地址:http://www.cnblogs.com/thinkpad/p/4694454.html