A

Admin • 833.24K Points
Coach

Q. Which of the following is the correct way to declare a function template in C++?

  • (A) template <typename T> T myFunction(T a) { }
  • (B) template <class T> T myFunction(T a) { }
  • (C) Both A and B
  • (D) None of the above
  • Correct Answer - Option(C)
  • Views: 34
  • Filed under category C++
  • Hashtags:

Explanation by: Admin

Both 'template <typename T>' and 'template <class T>' are valid ways to declare a function template in C++.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.