Thursday, December 13, 2012

inline function in c++


#include<iostream.h>
#include<conio.h>
class New
{
public:
inline long mul(int num1,int num2)
{
return num1*num2;
}
long add(int num1,int num2);
};
inline long  new::add(int num1,int num2)
{
return num1+num2;
}
void main()
{
int a,b;
clrscr();
cout<<"Enter the two no\n";
cin>>a>>b;
New obj;
cout<<"The multiplication is="<<obj.mul(a,b)<<"\n";
cout<<"The addition is="<<obj.add(a,b)<<"\n";
getch();
}

Output