P

Priyanka Tomar • 35.28K Points
Coach

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

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

Explanation by: Priyanka Tomar
Both 'template <typename T>' and 'template <class T>' are valid ways to define a class template in C++.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics