#include <stdio.h>
struct Base {
    int num;
    #define DEFAULT_BASE() {.num =1}
};

struct DerivedA{
    struct Base base;
    int a;
    #define DEFAULT_DERIVEDA() {DEFAULT_BASE() , .a = 2}
};

struct DerivedB{
    struct Base base;
    int b;
    #define DEFAULT_DERIVEDB() {DEFAULT_BASE() , .b = 2}
};

struct DerivedA instA = DEFAULT_DERIVEDA();
struct DerivedB instB = { DEFAULT_BASE() , .b = 3 };

void func(struct Base * p){
    p->num++;
}

int main() {
    func(&instA);
    func(&instB);
	printf("A->num:%d , a:%d\nB->num:%d , b:%d" , instA.base.num , instA.a , instB.base.num , instB.b );
}