A

Admin • 833K Points
Coach

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

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

Explanation by: Admin

Both 'template <typename T>' and 'template <class T>' are valid ways to define a member function outside a class template.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.