Write a program that will demonstrate inline function. The program that uses the following properties- class name- check, integer type private member variable - f, g; one argumented constructor function - check(int o, int p), one int type public member function mul(), one argumented object mn(45, 10). mul() function will multiply the value 45*10 and the output will be 450.
#include<iostream>
using namespace std;
class check
{
int f,g;
public:
check (int o,int p);
int mul()
{
cout<<"The result is ="<<f*g<<endl;
return 0;
}
};
check::check(int o,int p)
{
f=o;
g=p;
}
int main()
{
check mn(45,10);
mn.mul();
return 0;
}
#include<iostream>
using namespace std;
class check
{
int f,g;
public:
check (int o,int p);
int mul()
{
cout<<"The result is ="<<f*g<<endl;
return 0;
}
};
check::check(int o,int p)
{
f=o;
g=p;
}
int main()
{
check mn(45,10);
mn.mul();
return 0;
}
No comments:
Post a Comment