If a class is derived using private or protected inheritance, then user code may not convert an object of derived type to a base type object.
why?
Because when using private or protected inheritance, access to the members of the base part of the derived object may become more restrictive than the base type(e.g., from public to protected). And access can become more restrictive, but cannot become more general.
阅读(448) | 评论(0) | 转发(0) |