In non-inline function when a function calls the controller
jumps to the function definition, but whereas in Inline
Function when a function calls the code in the function
replaced instead of jumping the controller.
inline function are those function in which the code is just inserted where the function is declared.
it is generally used for function which are small in size and don,t involve any loop.
it just a way to decrease the time of function call.
Actually inline functions are used to overcome the demerits
of preprocessor macros and non-inline functions.
Whenever a function call is made function address, formal
arguments and return address will be stored in the stack.
Which leads the overhead to the compiler. To overcome this
inline functions are introduced.
Inline functions are the requester to the compiler to
replace the function definition at the function callers.
Here it is same as preprocessor macros but not equal to 100%
The decision of implementing inline is done by compiler.
Points to be consider b/w inline && non-inline functions:
1. inline executes faster than non-inline functions.
2. Using inline will increase the code size than the
3. inline are ignored if the function definition contains
more code or loops or conditions.
4. if you define a function inside the class by default it
will treat it as a inline.
create a class complex having real and imaginary part of a
complex no. as a data member. overload the binary
operators(+,- and *) to perform the operations on complex
no. objects. overload binary operator using friend function.