0

Does a empty class object takes memory?

If we create a object of a class in which there is no variable ,will it take memory and if yes how much?

9th Apr 2020, 7:32 AM
Karan singh majila
Karan singh majila - avatar
2 Réponses
+ 2
According to C++ standard size of any class is at least 1 byte, even that class is empty.
9th Apr 2020, 10:10 AM
andriy kan
andriy kan - avatar
+ 1
Yes. According to my test code a class always stores at least one byte: https://code.sololearn.com/cZX5xuG1vkNY/?ref=app
9th Apr 2020, 7:39 AM
Aaron Eberhardt
Aaron Eberhardt - avatar