RTUComputer ScienceYr 2024 · Sem 32024

Q10Object Oriented Programming

Question

What is generic programming?

Answer

Generic programming utilizes C++ Templates to write absolutely type-agnostic algorithms, letting the compiler mathematically generate the exact type-specific code.

Generic Programming is a highly advanced paradigm implemented via C++ Templates. It allows a programmer to write a single, complex algorithm without strictly defining the data type. The compiler aggressively analyzes the template and mathematically generates highly optimized, type-specific versions of the code on-the-fly during compilation, achieving massive code reuse without sacrificing runtime execution speed.

Back to Paper