I am trying to return an object that should be an implementation with a common type of icalase that is used for itepe The implementation is. / P>
public iceless & lt; ITYPE & gt; CreateClass () {new actual class (;); }
The actual class I want to return extends the class (abstract), with the actual type of a common type:
public class real Class class & lt; Actual type & gt;
The abstract class object implements the interface, and there can be any type that extends the ITIP
public elixir class class & lt ; T type IT & gt; ICLASAs & lt; T & gt;
Actual type simply implements the ITIP interface
The public final class implements the actual type ITIP
One kind of "mismatch: error on compilation" can not be converted from actual class to iCallis "I do not understand that because the actual class applies to IcLALAS (indirectly through the class) And active type
How can I rearrange this so that it works? What have I done wrong or wrong?
Ideally I still have an interface ICLAS and ITIP, intangible implementation class, and then want to have an actual class which enhances the intangible class and is a specific type of ITIP.
the actual class hierarchy
in this way :
IClass & LT; ActualType & gt; ^ | Class & lt; ActualType & gt; ^ | Actual Class
Then, IClas & lt; Actual type & gt;
is super type of actual class
. But the return type of your method is iCilas & lt; ITYPE & gt;
. Although IType
super type of real type
, iclas & lt; ITYPE & gt;
A super type of IClass & lt; ActualType & gt;
, and thus it is not even super code actual class
.
Therefore, either IClass & lt; ActualType & gt;
, IClass & lt;? ITYpe & gt;
Spreads the following:
Public ICas
? ITepe Extended & gt; CreateClass () {new actual class (;); }
No comments:
Post a Comment