Is there a way to force a class/enum to only be accessible in the same file, similar to how static functions/variables behave?
// free-floating static function
// basically I want similar access restrictions on helper-type classes/enums
static void func(void)
{
}
// this is a compiler error
static class A
{
};
A class declared inside an Unnamed namespace is what you want:
This will be named mangled in such a way by the compiler that it is inaccessible outside of that translation unit.