template_sum.cpp: This program is about creating template function for adding two numbers.
Date: 13/04/2009.
Author: Afiz ******
*/
#include
using namespace std; //
class math{ // main class.
public: // access modifier.
template
{
return (a+b);}
};// end of the math class.
int main() // main class.
{
math obj; // creating object in math class.
float a, b;
string type="int";
cout << "Please Enter the two values\n";
cin >>a>>b;
cout <<> (a,b)<< endl;
// calling template function. we can pass any type here
system("pause"); // system pause function.
return 1; // return statement.
}
No comments:
Post a Comment