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 are enumerations?
How would you implement a substr() function that extracts a sub string from a given string?
In a function declaration what does extern means?
What is an inline function in c++?
Write about the retrieval of n number of objects during the process of delete[]p?
How would perform Pattern Matching in C++?
What is purpose of abstract class?
What is ostream in c++?
Is c++ still being used?
What do you mean by inheritance in c++?
When does a 'this' pointer get created?
What is rvalue?
Explain stack unwinding.
Can there be at least some solution to determine the number of arguments passed to a variable argument list function?
what is a class? Explain with an example.