Encyclopedia > Genericity

  Article Content

Genericity

Genericity in object-oriented programming: A class is generic when its code uses at least one undefined type.

Let's take a vector class as an example. Normally you would have to write the code for lots of different vector classes, one for each stored type: "VectorString", "VectorInteger", "VectorFloat" and so on. By writing a generic class, its code suits any stored type you want. When referring to the stored type, you simply write a tag (for instance: "<WHATEVER_TYPE>") instead of a specific type. The compiler will then replace that tag for what is needed.



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
Bugatti

... production models were rolled out. Bugatti purchased Lotus Cars from General Motors in 1993. A luxury saloon (EB112) was planned, but never got beyond th ...

 
 
 
This page was created in 36.6 ms