Say class A had method do(); and class B had field data;. I wonder if there is a way (using Boost for example) to create a class union from A and B which would have method do() and field data?
Say class A had method do(); and class B had field data; . I
Share
Union has a specific meaning in c and c++, and it’s not what you want. It sounds like you want is multiple inheritance, a class
Cthat inherits from bothAandB. Alternatively, you could also have a classCthat contains instances of classesAandB. Oftentimes composition (“has-a”) is preferable over inheritance (“is-a”).