Ask Question
14 June, 02:52

if we declare a function as friend of a template class will it be a friend for a particular data type or for all data types of that class.

+3
Answers (1)
  1. 14 June, 05:19
    0
    When we declare a function as a friend of a template class, it means it can access the public, as well as the private and protected members both data variables, and functions of that class. Thus, the friend has access not only to certain data types, but they have access to all the data types of that class. Thus, the function declared as the friend is never deprived of accessing any particular data type of a template class, or any class.

    Explanation:

    However, you should understand what is template class as well. A template class is the one that is a template and can be transformed into various object code for various data types, that supports all the operators used inside that class or function. We do have the template function. And these behave generically.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “if we declare a function as friend of a template class will it be a friend for a particular data type or for all data types of that class. ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers