BDE 4.14.0 Production release
|
Provide a compile-time check for derived classes.
This component provides a meta-function, bslmf::IsAccessibleBaseOf
, that determines whether one class is an accessible base class of another class. The static constant bslmf::IsAccessibleBaseOf::value
is true
if the template parameter t_BASE
class is an accessible base class of, or the same class as, the template parameter t_DERIVED
. Otherwise, bslmf::IsAccessibleBaseOf::value
is false
. The specific cases of private, protected, and ambiguous inheritance are not supported for versions of C++ prior to 11.
In this section we show intended use of this component.
Define two classes, one inheriting from the other.
Evaluate bslmf::IsAccessibleBaseOf::value
.
Define two classes, one inheriting privately from the other.
Evaluate bslmf::IsAccessibleBaseOf::value
. Note that Derived
is not observably derived from Base
, so std::is_base_of would evaluate true
, but bslmf::IsAccessibleBaseOf
evaluates false
.