inline() is function, is used for copying the code of called function code in place of function call inside the calling function. but it is restricted only for small functions but not for big function because big function have much code so it takes more time to copy in that function call inside the calling function. why we r using dis fucntion is to avoid frequently calling same function from calling function for a called function we are using inline function bcoz it copies the called function code at first call of d function inside function call.
inline functions are used to avoid the over head work of compiler.when keyword inline is used before a function the compiler will process it directly instead of moving it to stack of memory. NOTE:inline functions are used in the functions which has merely 2 or 3 lines.it can't be used for functions involving loop,recursive functions......
When you see the keyword INLINE before a function it is called a inline function. The code of the inline function should be small. The difference between the inline function and a normal function is known while tracing the program by pressing the F7 button repeatedly. EXAMPLE TO SHOW INLINE FUNCTION: #include<iostream.h> #include<conio.h> inline void display(); class demo { public: void display() { cout<<"kishore reddy"; } }; void main() { clrscr(); demo d; d.display(); getch(); }
//in above program when you call the d.display() function the control will not jump to that function, the code written in that function will be substituted at the call.