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
How many different levels of pointers are there?
How many keywords are used in c++?
What are static member functions?
What are 2 ways of exporting a function from a dll?
What is expression parser in c++
Write a recursive program to calculate factorial in c++.
Explain the isa and hasa class relationships. How would you implement each?
What is a string example?
What is the difference between cin.read() and cin.getline()?
Write a struct time where integer m, h, s are its members?
What is the difference between ++ count and count ++?
When there is a global variable and local variable with the same name, how will you access the global variable?
What is the latest version on c++?
What is data hiding c++?
How do I run c++?