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
What is using namespace std in cpp?
Is c++ primer good for beginners?
How did c++ start?
What does I ++ mean in c++?
What data encapsulation is in c++?
Can a class be static in c++?
What are pointers used for c++?
What is algorithm in c++ programming?
Explain what is oop?
What is vectorial capacity?
How to defines the function in c++?
Difference between declaration and definition of a variable.
What is a local reference?
What are the types of container classes?
What is the advantage of an external iterator.