title: does a derived class object contain private members of the base class? What does it look like in memory?
body: <pre><code>class base{
  private:
    int a;
  public:
    int b;
    void setData(){
      a = 10; b = 5;
    }
  };
  class derived: public base{
  private:    
     int c;
  public:
    // b is inherited
  };
  
  void main(){
    derived D1;
  
    D1.setData();
  }
  </code></pre>
  
  <p>I learned that private members aren't inherited. So, the private variable a (in the base class) is not present in the derived class object. My question is <strong>when D1.setData() is called, how can it assign a value to a, if a doesn't exist?
  I'm pretty sure I have this concept wrong, so can some one explain how this works? Are the base class members also created when the derived class object is created?</strong> </p>