Friday, September 23, 2016

Inline Function

Tags

Program To Illustrate The Concept Of Inline Function:
#include<iostream>
using namespace std;
class sample
{
    int x;
    public:
        void getdata()
        {
            cout<<"Enter Value Of x ";
            cin>>x;
        }
        void display();
        void increment();
       
};
inline void sample::display()
{
    cout<<"\nValue is\n"<<x;
}
inline void sample::increment()
{
    x++;
    cout<<"\nAfter Incrementing\n";
}
main()
{
    sample s;
    s.getdata();
    s.display();
    s.increment();
    s.display();
}