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
I need help programing this... In this exercise, you will create a program for the sales manager at Computer Haven, a small business that offers motivational seminars to local comp

Variables Information stored in a variable can alter in the course of the program. The type used in the definition explains the kind of information the symbol can store. Variab

Write out pseudocode for a function called "and" that takes two arguments, both booleans, and returns the logical and of the inputs. DO NOT use the logical and operator: instead, w

Project Description: We want an EXPERT CODER to help us create an 'audio engine' in C#. We want to be able to specify an input of a wave/MP3 file, and have the engine manipul

Explain what are Unions? The Unions like as structures, contain members whose individual data types may perhaps differ from one another. Though the members that create a union

Overloading Binary Operators class SI {float i,p,n,r,a; public: SI(){}; SI(int gp,int gn, int gr); void putdata(void); SI operator+(SI); }; SI SI::opera

Want a scraping program created Project Description: We need to hire a professional developer to scrape the site for information such as *product title *Product Price

Primarily the term alignment refers the tendency of an address pointer value to be a multiple of some power of two. Thus a pointer with two byte alignment contains a zero in the le

Destructors A destructor function gets implemented whenever an instance of the class to which it belongs goes out of existence. The primary usage of a destructor function is

Important Note: No course works, which have been submitted via hard copies or emails, will be accepted a short essay below edited in a document (word, other) files with