RCD -- Restricted Class Declaration
Go Up to C++ Audits
Description
RCD detects classes that cannot be used by their supposed clients. Such classes are:
- public classes that do not contain public members and public or protected constructors. This check is performed when the RCDCheckPublicClasses option is set.
- Non-instantiable classes that do not contain non-private static members. Such classes cannot be used by any other class. This check is performed when the RCDCheckNoninstantiableClasses option is set.
Incorrect
class Property {
Property(char* id) {
...
}
Object getValue() {
...
}
void setValue(void* val) {
...
}
};
Correct
public class Property {
public:
Property(char* id) {
...
}
Object getValue() {
...
}
void setValue(void* val) {
...
}
};