What are inline functions?

Answer Posted / roshanpr

Functions that are expanded inline ( that we during there
call) is called inline functions.

Usually when there there is a function call the control is
taken to the function definition where the code is executed
and then the control returns back to main. But in case of
inline function there is no jump in the flow, rather the
function it self is expanded at the place of call.

You can make function inline in two ways.

1) Prefixing keyword "inline" durin the function
declaration.
2) By defining the function inside the class declaration

Ex: shows both the implementation

Class myClass
{

int age;

public:
inline void getAge();
void showAge()
{
cout<<"Age:"<<age;
}
};

void myClass getAge()
{
cout<<"Age:"<<age;
}

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does obj stand for?

823


What is enum c++?

842


Write a program which employs Recursion

962


Can non graphic characters be used and processed in C++?

894


What are the vectors in c++?

755






Can I uninstall microsoft c++ redistributable?

769


Write a program to find the Fibonacci series recursively.

806


Comment on c++ standard exceptions?

839


Which programming language should I learn first?

746


Why was c++ made?

827


What are the types of array in c++?

787


What are activex and ole?

755


What is an inline function in c++?

827


What is a sequence in c++?

742


What are the manipulators in c++?

754