There is an important feature in C++, called as inline function. These functions are commonly used with classes.

Inline function are short functions which are not actually called, rather, their code in expanded in line when they are invoked. To make a function inline just precede it with the keyword inline, this way the function will get expanded inline at the point of invocation.

EXAMPLE


#include<iostream.h>
using namespace std;


inline int max(int a, int b)
{
return a>b ? a: b;
}

int main()
{
cout<<( 10>20 ? 10 : 20);
cout<< ” “<< (99>88 ? 99 : 88);
return 0;
}

 

The reason that inline functions are so important in C++ because they allow you to create a more efficient code.
Classes require several executed interface functions, the efficiency of these functions is of great concern.