Type polymorphism and type variance
Ali Çehreli
acehreli at yahoo.com
Thu Dec 6 12:15:22 PST 2012
On 12/06/2012 12:08 PM, js.mdnq wrote:
> On Thursday, 6 December 2012 at 03:22:55 UTC, Ali Çehreli wrote:
The following comment is relevant:
>> /* Although this can be a polymorphic type, I am assuming that all of
>> the edge
>> * handlers will produce the same type of result. */
>> struct HandlingResult
>> {}
> Remember though, the return type of the functions have to match the node
> type they are associated with.
If HandlingResult is an interface, then the Edge functions can all
return a descendent of that interface. (In OOP speak, edgeHandler()
functions would have "covariant return types".)
Ali
More information about the Digitalmars-d-learn
mailing list