Next: High Integrity CPP Rule 3.1.2  Up: 3.1 General  Previous: 3.1 General  Contents

High Integrity CPP Rule 3.1.1   Organise 'class' definitions by access level, in the following order : 'public', 'protected', 'private'.
(QA C++  2108, 2109, 2191, 2192, 2195)

Justification

Order by decreasing scope of audience. Client program designers need to know public members; designers of potential subclasses need to know about protected members; and only implementors of the class need to know about private members and friends.

   
   class C           // correct access order
   {
   public:
   // ...
   protected:
   // ...
   private:
   // ...
   };
Reference

Industrial Strength C++ A.12, A.13;


HICPP VERSION 2.4  http://www.codingstandard.com   Copyright: © 2007 THE PROGRAMMING RESEARCH GROUP