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
Give 10 points of differences between C & C++.
How do you save a c++ program?
What is #include cmath?
How many standards of c++ are there?
What is an inclusion guard?
How would you use qsort() function to sort an array of structures?
Why is it necessary to use a reference in the argument to the copy constructor?
How to demonstrate the use of a variable?
Why do we use constructor?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it.
In a function declaration what does extern means?
What programming language should I learn first?
Is c++ vector a linked list?
Write about the various sections of the executable image?
What do you mean by overhead in c++?