What are the advantages and disadvantages of using inline
Answers were Sorted based on User's Feedback
Answer / nidhi singh
advantages of inline-no function calls need to be
generated.no stack required.
disadvantage -inline functions require more space..
the whole definition is copied.
by using const we insure the value of variable is not goin
|Is This Answer Correct ?||42 Yes||13 No|
Answer / vivek mahto
Well for the inline..
inline is a compiler directive so it will make compiler to copy the whole function where it is required , So there is no stack frame required in the stack section for storing the address of the function .
inline should only be used for the long functions as it will require more space as well as more calculation time.
For the const...
If you want any variable to keep constant through out the program then you can use const keyword. It is stored in the read only of the initalized data segment , even the pointer storing it's location cannot change the value of it, pointer can just change the address to point at some other location.
As the const is not flexible so mostly people use #define which is more flexible than const
|Is This Answer Correct ?||4 Yes||1 No|
Describe friend function & its advantages.
without if else statement can be written ah
Can we use pointers in c++?
is throwing exception from a constructor not a good practice ?
How to implement is-a and has-a class relationships?
What character terminates all character array strings a) b) . c) END
What are proxy objects?
Differentiate between late binding and early binding. What are the advantages of early binding?
What is late binding c++?
What is the C-style character string?
Differentiate between an external iterator and an internal iterator?
Can c++ do everything c can?