Why are generics called generics?

后端 未结 9 871
野性不改
野性不改 2021-02-04 00:48

At the risk of becoming the village idiot, can someone explain to me why generics are called generics? I understand their usage and benefits, but if the definition of generic i

9条回答
  •  故里飘歌
    2021-02-04 01:45

    Because you are creating "Generic" code that will be capable of operating on any type (within constraints you specify) in the same way...

    a good example you are familiar with is the Add operator is just about any language... it can "Add" integers, floats, doubles, decimals, binarys, hexadecimals, regardless of whether they are signed, unsogned, how many bits they are, etc...

提交回复
热议问题