title: Trying to make sense with my understanding with Constructors in CPP
body: <p>Lets discuss on the next code sample:</p>
  
  <pre><code>class A
  {
  public:
      int a;
  };
  
  class B:public A
  {
  public:
  
      int a;
  };
  
  
  int main()
  {
      B b;
      std::cout &lt;&lt; b.a;
      system("pause");
      return(0);
  }
  </code></pre>
  
  <p>Why if I'm writing its like this, So its cant compiles, and giving me error.</p>
  
  <p>But if I add a constructor to B class, like this:</p>
  
  <pre><code>B()
  {
  // An empty constructor!!!
  }
  </code></pre>
  
  <p>then it prints on the screen a garbage value ('a' variable value.).
  And why I don't need any constructor if I'm writing the class like this:</p>
  
  <pre><code> class B:public A
   {
   public:
       int a = 5;  // 5 is just one of many possibilities...
   };
  </code></pre>
  
  <p>In that case, 5 will be printed on the screen.</p>