What is difference among macro and template?, C/C++ Programming

A: In C++ there is a main difference among a template and a macro. Merely a macro is a string which the compiler replaces along with the value that was defined. For example #define STRING_TO_BE_REPLACED "ValueToReplaceWith"

A template is a method to make functions independent of data-types. It cannot be accomplished via macros.

For example a sorting function doesn't have to care whether it's sorting integers or letters as the same algorithm might apply anyway.

 

Posted Date: 3/21/2013 7:25:02 AM | Location : United States







Related Discussions:- What is difference among macro and template?, Assignment Help, Ask Question on What is difference among macro and template?, Get Answer, Expert's Help, What is difference among macro and template? Discussions

Write discussion on What is difference among macro and template?
Your posts are moderated
Related Questions
Write a program that keeps record of football results. Program stores following information about each match: Description Type and/or size name of home team max. 25 characters name

a) Implement a binomial tree class with a method that calculates the value of an option passed in to the class. The binomial tree should not rely on specific features of the differ

decodes the sending smuggler string from the number format into plain text

program for compiler design in c

C Program for SORTING OF NUMBERS   main() {           int a[20],i,j,temp,n;           clrscr();           printf("ENTER THE MAXIMUM LIMIT: ");           scan

#decode the code

Compiler Design - Limit In The Method Instructions


what happens when the following command is used? chmod u=rwx,go=r-x foo

Armed with your function from above, we can do some interesting things. For instance, any pixel where the offsets are both zero is a pit (lower than all surrounding points) .