Код: Выделить всё
CommonBase
/ \
/ \
DerivedA DerivedB
\ /
\ /
Joined
Код: Выделить всё
struct CommonBase {
CommonBase() : CommonBase(0) {}
CommonBase(int val) : value(val) {}
const int value;
};
struct DerivedA : public virtual CommonBase {
void printValue() {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/53814616/i-have-a-diamond-inheritance-hierarchy-virtual-x-%e2%86%92-a-b-%e2%86%92-y-%e2%86%92-z-why-does-z-n[/url]
Мобильная версия