scala - Partial definition of generic abstract function -


It is possible to declare a common abstract function in a base class in scale, and then to provide different concrete implementations in different derivative classes such as It:

  Abstract class B {def foo [T, V] (u: T): V} square D expanded {def foo (u: T_0) = {...} def Foo (u: T_1) = {...} ....}  

and similarly the classes derived from B for D1, D2, ... (potentially T-J with different concrete types)

The question in short is: A class is To use the OBAB. FU (U) and the compiler flag to cross the square D_J, when FU is used for any type of argument. At least one concrete type is taken from concrete taken from BB defined for T?

For example, you can type U and T If you can not be an expert in D , you need to match the parameters from the base class. You can not even partially provide special cases of override within a subclass, such as a partial function - a solid square will have to cover all the parameters, implementing each abstract method.

I think what you really want, type parameter at the class level is only on B , therefore derived classes are experts of those standards and then FU They become heirs especially the law. So, you want to do something like this:

  abstract square b [t, v] {def foo (u: T): v} extension of class db [string, ante] {deff FU (U: string): int = u.lining}  

(You can find variance annotation class B [-T, + V]] also useful. , But this is another story.)


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -