DT Big Data Dream factory 81st Talk
Http://yun.baidu.com/s/1uLFye
In this section, Mr. Wang speaks of the inverse of list, covariance, the Nether.
Abstaract class Big_data
Class Hadoop extends big_data//one type
Class Spark extends big_data//another type
Object List_constructor _internals{
def main (args:array[string]) {
Val hadoop=new hadoop::nil//a list of Hadoop
Val big_data=new spark::hadoop//A list of both Hadoop and Spark,
This is because Hadoop can append spark because:: The parameter of the method is the contravariant point,
If you follow the normal upper bound, if Hadoop is a subclass of Big_data,
Then List[hadoop] should be the parent class of List[big_data]
But in fact we expect list[big_data] to be the parent of List[hadoop] (covariant)
So let him exist in the Nether [b>:a] rather than [a<:b], as we wish.
}
}
DT Big Data Dream factory 81st Talk