Question
Easy

A generic function can be created using the following:

1
Inheritance
2
Data hiding
3
Polymorphism
4
Template
Question Details
Time to Solve: 12
Exam: HTET
Level/Paper: Level 3
Chapter: Object-Oriented Programming (C++)
Topic: Inheritance
Correct Answer
Option D
Explanation

The correct option is (4): The correct tool for creating a generic function is the Template. Templates are the fundamental C++ feature that enables Generic Programming, which is the philosophy of writing code that works correctly with various data types without needing to be rewritten for each one. By using a function template, you write a single blueprint for the function, defining its logic with a placeholder type. When this…Read More