91. Basics of Classes

Question.3

A developer compares a C struct and a C++ class with the same members:

struct S { int a; float b; uint8_t c; };
class C {
   int a; float b; uint8_t c;
public:
   void process() { /* logic */ }
};

printf("%zu %zu", sizeof(S), sizeof(C));

What is the output on a 32-bit platform?

Need Help? Refer to the Quick Guide below

Select Answer