





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















void PrintInt( int n ){
cout << "***Debug" << endl;cout << "Value is " << n << endl; } void PrintChar( char ch ){
cout << "***Debug" << endl;cout << "Value is " << ch << endl; } void PrintFloat( float x ){
} void PrintDouble( double d ){
To output the traced values, we insert: PrintInt(sum);PrintChar(initial);PrintFloat(angle);
-^
-^
template<class
SomeType>
void
Print(
SomeType
val
)
{
cout
<<
"***Debug"
<<
endl;
cout
<<
"Value
is
"
<<
val
<<
endl;
}
To output the traced values, we insert: Print
Template parameter(class, user definedtype, built-in types)
Templateargument
-^ A C++ language construct that allows the compilerto generate multiple versions of a class by allowingparameterized data types.
-^
-^
GList_int list1;GList_float list2;GList_string list3;
template argument
template
data[length] = item;length++; } //after substitution of floatvoid GList
data[length] = item;length++; }
-^
-^