Рассмотрим следующий пример:
Код: Выделить всё
#include
#include
struct A { char a; };
struct B {
B() { std::memset( this, 0, sizeof(B) ); }
};
struct C : A, B {};
static_assert( sizeof(C) == 1 );
int main() {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78221036/is-it-legal-to-zero-empty-c-classes-in-the-constructor-and-inherit-from-them[/url]