Search code examples
c++classcoding-styleindentation

Indentation of "public" and "private" visibility modifiers


I usually indent the public: and private: access specifiers like this:

class Foo()
{
    private:

    void Bar1() {}

    public:

    void Bar2() {}
}

Xcode doesn't seem to like this, however, so I feel like I'm doing something incorrectly. What is considered common practice for indenting private: and public:?


Solution

  • "Religious" question :-) You will get many different answers I think.

    I say:
    Which ever you like as long as you are consistent.