Code inspection: Access specifier does not change accessibility level
Redundancies in Code | |
| |
| |
C++ |
This inspection notifies you about access specifiers that have no effect on the semantic of the program.
In the example below, the second and third public:
would be grayed out because they follow the first public:
without any other specifiers in between. So in effect you can remove them to improve readability without changing the meaning of your program.
class Person
{
public:
int age;
public: //Access specifier does not change accessibility level
string name;
public: //Access specifier does not change accessibility level
int gender;
}
Note that even the first access specifier could be redundant if there is the same access specifier in a macro expansion that precedes it.
Last modified: 11 February 2024