Inline Function in C++

In a C++ language  An inline function is similar to macros. Inline function is also called as open subroutine because their code is replaced at the place of function call in the caller function. 

In a C++programming  normal  function  are known as closed  subroutine because when such function are called ,the control passed to the function.       

inline function  reduces  the overhead of accessing the member function, increases the efficiency of program and allows quick execution of function.

Example of inline function

Output

Note:
1 Inline function used when the member function contains few statement.
2  If function takes more time to execute , then it must be declared inline.                     .

   

Categories C++