As stated in cppreference.com class inheritance have underlying rule set.
Inderited as | Type in Base | Type in Derived |
---|---|---|
public | public | public |
protected | protected | |
private | unaccessible unless friended | |
protected | public | protected |
protected | protected | |
private | unaccessible unless friended | |
private | public | private |
protected | private | |
private | unaccessible unless friended |