1.

Member functions of a generic class are _____________(a) Not generic(b) Automatically generic(c) To be made generic explicitly(d) Given default type as doubleI have been asked this question in an online quiz.My question is from Member Functions in chapter Class Members & Types of Object Oriented Programming

Answer»

Correct answer is (b) Automatically GENERIC

Explanation: When generic type is used in a CLASS, the functions are automatically generic. This is so because the functions would use the same type as defined to MAKE the class generic. The functions will get to know the type of DATA as soon as the generic class is used. It’s INBUILT feature.



Discussion

No Comment Found

Related InterviewSolutions