Definition of inline | Sololearn: Learn to code for FREE!


Definition of inline

hi my friends what is the inline method or function and its role ;

3 Answers

New Answer


1)What is inline function ? The inline functions are a C++ enhancement feature to increase the execution time of a program. Functions can be instructed to compiler to make them inline so that compiler can replace those function definition wherever those are being called. Compiler replaces the definition of inline functions at compile time instead of referring function definition at runtime.  NOTE- This is just a suggestion to compiler to make the function inline, if function is big (in term of executable instruction etc) then, compiler can ignore the “inline” request and treat the function as normal function. 2)How to make function inline ? To make any function as inline, start its definitions with the keyword “inline”. 3)Example : Class A { Public: inline int add(int a, int b) { return (a + b); }; } Class A { Public: int add(int a, int b); }; inline int A::add(int a, int b) { return (a + b); }


@عبد الله بوستة You are wlcome ☺