Inline number function: – OOP provides feature of separating policy from the mechanism. Police provides guidelines for defining specification whereas mechanism provides guidelines for design and implementation. If is good practice to declare the class specification first and then implement class member function outside the class specification. The inline member function are a group of member function that decreases the overhead involved in accessing member function and make the uses of member function more efficient. An inline member function is treated as micro, any call to this function in a program is replaced by the function itself. This is called inline exception. By this the overhead include in the transfer of controlled by function call and function return statement are cut down. Note that inline function are also called open subroutine. Since they gate expended at the point of a call whereas normal function are called closed subroutine since only call to a function exists at the point of their call. A member function prototype define with in a class is declared without any special keyword.

C++ treats all the member function that are define with in a class as inline function and those defined outside as none-inline, outline or outside member function. The member function declared outside the class declaration can be made inline by prefixing the keyword inline. Syntax the keyword inline. Syntax of the inline member function definition as outline member function is: –

Inline <return type> <class name>::<function name> (argument)
{
                Body of inline member function
}
Advertisements