An application performs arithmetic operations on various data types without modifying existing code. Which concept facilitates this?
- Template Functions
- Overloading
- Observer Pattern
- Factory Pattern
Template functions in C++ allow functions to operate on generic types. This means a single function template can work on different data types without any code modification. For arithmetic operations, using template functions ensures that the same function can work on integers, floats, complex numbers, etc.
Loading...
Related Quiz
- In C++ STL, which algorithm is most suitable for rearranging elements in a range, so they are in reversed order?
- What does the new operator do in C++?
- What is a destructor used for in C++?
- What is the basic idea behind recursion in programming?
- Which class is primarily used for performing input operations on files in C++?