What are inline functions?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / laxman
Inline function :-
In genereal function call branching method is there . In
inline function substitution takes place . Inline
functions are expanded during compilation . Exectution
becomes fast and branching is eliminated. Inline word is a
request but not command. If inline is not possible compiler
takes it like a genral function call.
rules:
1 function should be small
2. Controll statements are not valid like for ,while
if u need more mail to me
| Is This Answer Correct ? | 6 Yes | 2 No |
Answer / nashiinformaticssolutions
Functions expanded at the point of call, avoiding function call overhead.
| Is This Answer Correct ? | 0 Yes | 0 No |
How would you stop a class from class from being derived or inherited?The constructer should not be Private,as object instantiation should be allowed.
Why c++ is called oop?
What do you mean by funtion prototype?
What are manipulators used for?
What is a sequence in c++?
What is #include sstream?
In which situation the program terminates before reaching the breakpoint set by the user at the beginning of the mainq method?
Why do we use vector in c++?
Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like. [ I ended up giving about 4 or 5 different solutions for this, each supposedly better than the others ].
which is best institue to learn C/C++ IN AMEERPET OR MAITHRIVANAM OR SR NAGAR, PLEASE HELP. THANKS IN ADVANCE
Why do we use pointers in c++?
what is multi-threading in C++?