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
What is this pointer in c++?
Define stacks. Provide an example where they are useful.
Do you know the problem with overriding functions?
what are function pointers?
How do you declare A pointer to function which receives an int pointer and returns a float pointer
What is the difference between while and do while loop?
Are strings mutable in c++?
What are virtual functions in c++?
What is the difference between a reference and a pointer?
Is c++ map a hash table?
Explain method of creating object in C++ ?
A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a saleperson who sells $5000 worth of merchandise in a week receives $200 plus 9 percent of $5000, or a total of $650. You have been supplied with a list of items sold by each salesperson. The values of these items are as follows: Item Value A 239.99 B 129.75 C 99.95 D 350.89 Write a program that inputs one salesperson's items sold in a week (how many of item A? of item B? etc.) and calculates and displays that salesperson's earnings for that week.
Can we change the basic meaning of an operator in c++?
What are friend classes? What are advantages of using friend classes?
Assume an array of structure is in order by studentID field of the record, where student IDs go from 101 to 500. Write the most efficient pseudocode algorithm you can to find the record with a specific studentID if every single student ID from 101 to 500 is used and the array has 400 elements. Write the most efficient pseudocode algorithm you can to find a record with a studentID near the end of the IDs, say in the range from 450 to 500, if not every single student ID in the range of 101 to 500 is used and the array size is only 300