Defining of Member Functions of Class in C++

Member functions can be defined at any one of the following two places: Outside the Class Inside the Class It is obvious that, irrespective of the place of definition, the function should perform the same task. Therefore, the code for the function body would be identical in both the cases. However, there is a subtle difference in the way the function header is defined. Both these approaches are discussed in detail as follows: Outside the Class Definition: Member functions that are declared (with the help of prototypes) inside a class have to be defined separately outside the class. Their definitions are very much like the normal functions. They should have a function header and a function body.However, an important difference between a member function and a normal function is that a member function incorporates a membership “Identity label” in the header. This labels tells the compiler which class the function...