Can you use sizeof on a class? If so, does only depend on its primitive values or does inheritance play a part as well? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can you use sizeof on a class? If so, does only depend on its primitive values or does inheritance play a part as well?

13th Apr 2016, 12:12 AM
Antonio Borges
Antonio Borges - avatar
3 Answers
+ 8
sizeof works on objects. It returns the size occupied by the object in memory. So, all the data connected with the object is taken into account.
26th May 2016, 1:13 PM
James Flanders
0
Yes.....We find these in file handling.....when we started saving information by classes
17th Jul 2016, 6:08 PM
Kamal Singh
Kamal Singh - avatar
0
yes it depends on inheritance....because it is accessing data from them
17th Jul 2016, 6:09 PM
Kamal Singh
Kamal Singh - avatar