Wednesday, September 7, 2016

PROGRAM TO ILLUSTRATE THE CONCEPT OF INLINE FUNCTION WITHIN THE CLASS

PROGRAM TO ILLUSTRATE THE CONCEPT OF INLINE FUNCTION WITHIN THE CLASS.

#include <iostream>
using namespace std;
class square
{
public:
int num;

void getdata()
{
cout<<"Enter the Number: ";
cin>>num;
}

int sq();
};

inline int square::sq()
{
return (num*num);
}

int main()
{
square s;
s.getdata();
cout<<"\nSquare of Number is "<<s.sq();
}