Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best explanation for the term "generic"?

I am looking for an good explanation, maybe with some examples. In my understanding, something is "generic" when it can be used for multiple purposes. But I may be wrong...

like image 552
Thanks Avatar asked Jan 22 '26 13:01

Thanks


1 Answers

The root is the same as "genus" -- it means describing all the members of a group of related things.

In programming terms, it means you're describing a whole collection of things that share a common pattern or template, with only small variations. C++ templates and Java generics are, to the programmer, more or less the same thing: a way of saying "whatever the underlying type is, I want to be able to do these things." The implementaiton methods are different, but the idea is the same.

So the idea is, itself, somewhat generic.

like image 70
Charlie Martin Avatar answered Jan 24 '26 10:01

Charlie Martin