Class, object and their memory: –

Class, object and their memory: – Class does not have physical existence so the memory for member variable will not be provided inside the class.

Object has physical existence so the memory for member variables will be provided inside the object when object is created. When the object is created, all non-static member variables either from same or different access specifier will be stored. Object does not store member function so any variable created inside member function will not also be stored inside object. The size of class and object will be same that depends on data types of member variables.


Comments are closed.

Create a website or blog at

Up ↑

%d bloggers like this: