Why don't people indent C++ access specifiers/case statements?

前端 未结 10 1700
悲哀的现实
悲哀的现实 2020-12-16 11:13

I often see stuff like this:

class SomeClass {
public:
    void someMethod();
private:
    int someMember;
};

This seems totally unnatural

10条回答
  •  半阙折子戏
    2020-12-16 11:50

    As mentioned earlier (though argued for non-indented access modifiers), access modifiers form logical blocks. While these are at the same level as the class braces, they are special.

    Thus it's useful to have indentation to clearly show where each block starts and ends.

    I personally think it makes the code clearer. Others will dissagree.

    This is a rather subjective question.

提交回复
热议问题