CodeQL library for C/C++
codeql/cpp-all 2.1.1 (changelog, source)
Search

Member predicate AccessSpecifier::accessInDirectDerived

Gets the visibility of a field with access specifier this if it is directly inherited with access specifier baseAccess. For example:

class A { protected int f; };
class B : private A {};

In this example, this is protected, baseAccess is private, and result is private because the visibility of field f in class B is private.

This method encodes the rules of N4140 11.2/1, tabulated here:

`this`           | `baseAccess`           | `result`
(access in base) | (base class specifier) | (access in derived)
----------------------------------------------------------
private          | private                | N/A
private          | protected              | N/A
private          | public                 | N/A
protected        | private                | private
protected        | protected              | protected
protected        | public                 | protected
public           | private                | private
public           | protected              | protected
public           | public                 | public
AccessSpecifier accessInDirectDerived(AccessSpecifier baseAccess)