#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++;
}

void Base_Print(struct Base * obj){
	printf("num:%d " , obj->num);
}

void DeriveA_Print(struct DerivedA * obj){
	printf("A->");
	Base_Print(obj);
	printf(", a:%d\n" , obj->a);
}

void DeriveB_Print(struct DerivedB * obj){
	printf("B->");
	Base_Print(obj);
	printf(", b:%d\n" , obj->b);
}


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