Consider a c++ template funtion
template<class T>
T& Add(T a, T b){return a+b ;}

if this function is called as
T c = Add("SAM", "SUNG");

what will happen? What is the problem in the template
declaration/ How to solve the problem.

Answer Posted / prasad

i will provide error.

declare template function as,
T Add(T a, T b){return a+b ;}

Is This Answer Correct ?    10 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How did c++ get its name?

777


What is the full form of c++?

901


Discuss the effects occur, after an exception thrown by a member function is unspecified by an exception specification?

843


What are manipulators in c++ with example?

792


What are function prototypes?

979


Should you pass exceptions by value or by reference?

911


What is the real purpose of class – to export data?

847


Write a program using GUI concept for the scheduling algorithms in Operating system like SJF,FCFS etc..

3592


What is the difference between global int and static int declaration?

629


What does n mean in c++?

843


How do I exit turbo c++?

780


How long will it take to learn programming?

801


List the features of oops in c++?

773


What is difference between c++ 11 and c++ 14?

775


How much is c++ certification?

774