#include #include #include struct Base { int value = 7; }; struct PublicChild : Base {}; class PrivateChild : Base {}; class Box { int value_; public: explicit Box(int value) : value_(value) {} int value() const { return value_; } }; int main() { static_assert(std::is_convertible::value, "public base"); static_assert(!std::is_convertible::value, "private base"); PublicChild child; Box box(9); assert(child.value == 7); assert(box.value() == 9); std::cout << child.value << ' ' << box.value() << '\n'; }