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
Which is the best c++ software?
What is the benefit of encapsulation?
What are manipulators used for?
Is c++ an oop?
How java is different from c and c++?
Why c++ is so important?
List the types of polymorphism in c++?
what is data abstraction in C++?
Which programming language should I learn first?
What is data types c++?
What is the need of a destructor? Explain with the help of an example.
What is algorithm in c++ programming?
What are c++ templates used for?
What is conditions when using boolean operators?
Why is that unsafe to deal locate the memory using free( ) if it has been allocated using new?