title: Override initial value of a member variable of base class
body: <p>I am very confused with the inheritance right now. I planned to simply override the initial value of a variable. In the following code i just inherit the base class and try to get it's name, which is saved as a string withing the class. I expected that the derived class can override this value, however it does not do it.</p>
  
  <p>My expected out put was</p>
  
  <pre><code>Derived
  Derived
  </code></pre>
  
  <p>However i get</p>
  
  <pre><code>Base
  Base
  </code></pre>
  
  <p>What is the correct way to implement the following?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  struct Base {
      virtual ~Base() = default;
      virtual void id(){
          std::cout &lt;&lt; id_ &lt;&lt; std::endl;
      }
      std::string id_ = "Base";
  };   
  
  
  
  struct Derived : public Base {
      virtual ~Derived() = default;
      std::string id_ = "Derived";
  };   
  
  
  int main(){
      Base* b = new Derived();
      Derived* d = new Derived();
      b-&gt;id();
      d-&gt;id();
      delete d;
      delete b;                                                                                                          
      return 0;
  }
  </code></pre>