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

What is the difference between #import and #include?

538


Is atoi safe?

582


How can I learn dev c++ programming?

553


Write is a binary search tree? Write an algo and tell complexity?

575


Write my own zero-argument manipulator that should work same as hex?

568






what is the difference between linear list linked representaion and linked representation? what is the purpose of representing the linear list in linked represention ? is it not avoiding rules of linear represention?

1740


When do we run a shell in the unix system?

552


How is objective c different from c++?

784


What is flush c++?

528


When should I use unitbuf flag?

570


What is prototype for that c string function?

678


Explain the operation of overloading of an assignment operator.

678


What flag means?

516


How many namespaces are there in c++?

547


Write a function to find the nth item from the end of a linked list in a single pass.

555