Memory for the object is allocated when they are declared and not when class is specified.Since all the objects belonging to the same class use the same member function, no separate space is allocated for functions when objects are created.
But the space for data member are allocated for each object because separate memory locations for the objects are essential and each object can hold different values.
But the space for data member are allocated for each object because separate memory locations for the objects are essential and each object can hold different values.
0 Comments:
Post a Comment