Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class definition and memory allocation

If definition stands for assigning memory. How come a class definition in C++ has no memory assigned until an object is instantiated.

like image 995
shreyasva Avatar asked Sep 11 '25 17:09

shreyasva


1 Answers

C++ Class definitions do not assign memory. class is like typedef and struct. Where did you get the idea that "definition stands for assigning memory"? Can you provide a quote or reference?

C++ Object creation (via new) assigns memory.

like image 133
S.Lott Avatar answered Sep 14 '25 07:09

S.Lott