title: Crashing on calling virtual methods
body: <p>I read about it in other questions but none of them was similar, some was about to call a virtual method in the constructor, others about pure virtuals, but the question here is about vituais methods that are not pure, but about virtual methods that doesn't need be implemented in all derivatives classes. If the class instantiated doesn't implements the method, if we call, it logically calls the method from the base and it crashes sometimes.
  I was wondering, why? What is VTABLE (where it enters)? And what is the best way to solve it.</p>
  
  <p>This is a simple example, (avoid answer like pure virtual).</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  class Foo
  {
  public:
      virtual std::string myString() {}
  };
  
  class Bar : public Foo
  {
  public:
  };
  
  int main(int argc, char ** argv)
  {
      Foo * bar = new Foo;
      bar-&gt;myString();
  
      return 0;
  }
  </code></pre>
  
  <p>What would be the best solution?</p>
  
  <ol>
  <li>Throw an exception</li>
  <li>Using assert(false)</li>
  <li>Returning a default value</li>
  <li>Avoid implementing a body and it will result in an error in
  compilation time</li>
  <li>None of the alternatives</li>
  </ol>
  
  <p>The best answer will be the one that explains why this happen based on VTABLE and of course, that choose one solution and explain why. The idea is not to base it on opinions.</p>