Test your Programming knowledge

50% users failed to get the best score. It's your turn to test now.
Questions curated by the expert mentors at codzify.com

Start Quiz


Inline Functions in C++

3 min 42 sec read

What are Inline Functions ?

To clean up the code we write functions outside the class and this is best way to write any object oriented code. So why Inline Function ?. When we declare any function as inline then while compilation, compiler will replace that call of a function with the exact code whic you had written outside of that class.

In this example , compiler will replace the statement ,

inline void display();


void Game :: display()

Benefit of this inline function is to increase the execution speed of a program . By writing inline it skips the step of function call which actually takes overhead in memory and replaces that line with actual code. So in this way code looks cleaned plus memory saving :)

using namespace std;
class Game
  int abc;

  abc = 5;
inline void display();

void Game :: display()

Output :-


Recommended Articles

Did you found this article helpful?

Try to execute what you have learnt

Easy to use online data structure compiler where you can execute the programs in your favourite programming language.
(C, C++, Python)

Open Compiler

HTML, CSS and Javascript Real time Web Editor

Execute your HTML, CSS and javascript code in real time with the web editor
(HTML, CSS, Bootstrap, Javascript)

Open Web Editor