Question 99Asked in BPSC TRE 2.0 (2023) Computer Class 9-10

How can one implement the compile-time polymorphism in the C++ programming language?

  1. ABy using the template
  2. BBy using the concepts of inheritance
  3. CBy using both the virtual functions and inheritance
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (A) By using the template

Explanation

Templates (along with overloading) are resolved at compile time, so they implement compile-time polymorphism; virtual functions give run-time polymorphism.

From BPSC TRE 2.0 (2023) Computer Class 9-10 — Previous Year Paper

This is question 99 of BPSC TRE 2.0 (2023) Computer Class 9-10 — Previous Year Paper. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.