C++ Inline function

An inline function is a function that is elaborated in line when it is invoked. When an inline function is called, all the code of inline function gets inserted at the point of function call. It increases the execution time of the program. This function uses the inline keyword before the function name.

Syntax

 

C++ inline Example 1

Output:

 

C++ inline Example 2

It is a good experience to write C++ program using class. The functions which are declared inside the class are implicitly inline function. An explicit inline function is declared inside the class and defined at outside the class.

Output:

Leave a Comment