re: Explain Generics Like I'm Five VIEW POST

VIEW PARENT COMMENT VIEW FULL DISCUSSION

I think this is the best explanation, but you might want to add how this maps to code as this is very abstracted away from code.

Given that this is an #explainlikeimfive post, abstracting away from the code is rather a fundamental requirement :).

But for completeness sake: the original books would have been the UnicornBook, DragonBook and LabradorBook classes, which are nearly identical expect wherever the Unicorn, Dragon or Labrador classes (or their instances) are used. The generic equivalent would ba a Book where T can be added for whatever you like, to create e.g. Book< Unicorn > or Book< Eagle >.

Hope that helps :-).

Heh, totally get where your coming from.

code of conduct - report abuse