The member function are created and placed in the memory space only once when they are defined as a part of a class specification. Since all the objects belonging to that class use the same member function, no separate space is allocated for member functions when the objects are created. Only space for member variables is allocated separately for each object. Separate memory locations for the objects are essential, because the member variables will hold different data values for different objects.
0 Comments