If I'm not mistaken, you do not quite understand what the purpose of the interface or type is.
. . , , . , . .
...
, . , , . : ", ICar IUser". , . , ICar, /, , ICar , Car. , ?
, , ( ), "Self Describable", , . :
ISelfDescribable {
getSelfDescription ( );
}
:
Car implements ISelfDescribable {
getSelfDescription ( return "I am a car!" );
}
User implements ISelfDescribable {
getSelfDescription ( return ...some other completely different way of getting the info... );
}
( , ):
Array<ISelfDescribable>
( , ) , , , "" ISelfDesribable. , , , , . .
, , "Insurable". "setInsurancePolicy". IInsurable { setInsurancePolicy ( policy : Policy ) } . , ISelfDescribable IInsurable, .
, , : ( ) . , . , , . , .
(: , Scala, . "", . , , , , ).