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.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *