Accessing child variables through higher level structures

后端 未结 8 1829
孤街浪徒
孤街浪徒 2020-12-09 17:41

If I have these structures:

typedef struct { int x; } foo;
typedef struct { foo f; } bar;

Normally you would access x through

8条回答
  •  青春惊慌失措
    2020-12-09 18:06

    This is not possible in C. In C++ however you can use inheritance which is probably what you were thinking about.

提交回复
热议问题