1.

What can be passed by non-type template parameters during compile time?(a) int(b) float(c) constant expression(d) stringI have been asked this question in exam.Query is from Function Templates topic in division Derived Classes, Templates & Exception Handling in C++ of C++

Answer»

The CORRECT CHOICE is (c) CONSTANT EXPRESSION

Easiest explanation - Non-type template parameters PROVIDE the ability to pass a constant expression at compile time. The constant expression may also be an address of a function, object or static class member.



Discussion

No Comment Found

Related InterviewSolutions