I just finished the templates chapter wich is covered in around 20 pages only in my C++ book. I understood it's essential concepts but i need to make some things clear :
Q1: Why would i use a template nontype parameter when i can simply add an extra argument to a function that uses that template for example?
Q2: function\class-template specilization is the object code produced that uses the same type sent to the template argument list, so if i call a function-template with int then another time with double data ; the compiler would produce 2 specilizations.
did i get it right?
Q3: Do templates go under "Polymorphism"?
Q4: Are these two template function calls different? if so , why? (arg is double) :
Code:foo<double>(arg);Q5: whats the difference between typename and class?Code:foo(arg);
appreciate your help



LinkBack URL
About LinkBacks


