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 binary search in c++?
What is the difference between prefix and postfix versions of operator++()?
What is vector pair in c++?
Is it possible for a member function to delete the pointer, named this?
Is java a c++?
Can I learn c++ in a week?
Is c++ a float?
When does a name clash occur in c++?
Explain the concept of dynamic allocation of memory?
Why do we need templates?
What are the general quetions are in DEna bank manager IT/System interviews?
What is the benefit of learning c++?
How to allocate memory dynamically for a reference?
Which is the best c++ compiler?
What is the most common mistake on c++ and oo projects?