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 the size of a vector?
What is the difference between object-oriented programming and procedural programming?
Which ide is best for c++?
What is the use of data hiding?
Where is atoi defined?
Why is it called c++?
Explain bubble sorting.
What are associate containers?
Where Malloc(), Calloc(), and realloc() does get memory?
In what situations do you have to use initialization list rather than assignment in constructors?
How compile and run c++ program in turbo c++?
What is the purpose of ios::basefield in the following statement?
What are references in c++? What is a local reference?
What are manipulators in c++ with example?
Explain storage qualifiers in c++.