title: Does public and private have any influence on the memory layout of an object?
body: <p>This is a followup to another question of mine: <a href="https://stackoverflow.com/questions/35196871/what-is-the-optimal-order-of-members-in-a-class">What is the optimal order of members in a class?</a></p>
  
  <p>Does it change anything (except visibility) if I organize the members in such a way that public, protected and private take turns?</p>
  
  <pre><code>class Example
  {
  public:
    SomeClass m_sc; 
  protected:
    char m_ac[32];      
    SomeClass * m_scp;
  private:
    char * m_name;
  public:
    int m_i1;
    int m_i2;
    bool m_b1;
    bool m_b2;
  private:
    bool m_b3;
  };
  </code></pre>
  
  <p>Is there a difference between this class and a class where I make all members public at runtime? I want to follow the rule of ordering the types from large to small (if readability is not seriously harmed).</p>
  
  <p>I assume that it does not affect the compiled program at all, just like <code>const</code> is only checked during compilation. Is this correct?</p>