title: Virtual inheritance and conversion from virtual base class
body: <p>I ran into a specific problem regarding virtual inheritance.
  The code below explains the structure.</p>
  
  <pre><code>// Header
  
  struct ITarget
  {
      virtual void SetValue() = 0;
  };
  
  struct ISource
  {
      virtual void GetValue() const = 0;
  };
  
  struct IBase
  {
      virtual void Stuff() = 0;
  };
  
  struct IInput :
      virtual public IBase, public ITarget
  {
      // Publicly acts only as Target
  };
  
  struct IOutput :
      virtual public IBase, public ISource
  {
      // Publicly acts only as Source
  };
  
  // Implementation
  
  struct SBase :
      virtual public IBase, virtual public ISource, virtual public ITarget
  {
      // IBase
      virtual void Stuff();
  
      // ISource
      virtual void GetValue() const;
  
      // ITarget
      virtual void SetValue( );
  };
  
  struct SInput :
      public IInput, public SBase
  {
      // Defines ITarget and ISource per SBase
  };
  
  struct SOutput :
      public IOutput, public SBase
  {
      // Defines ITarget and ISource per SBase
  };
  
  int main()
  {
    // To demonstrate the behavior
    ISource* input = new SInput();
    ((SInput*)input)-&gt;GetValue();
    return 0;
  }
  </code></pre>
  
  <p>Now, if I want to cast an <em>ISource</em>* to an <em>SInput</em>*, I get error C2635:</p>
  
  <blockquote>
    <p>"cannot convert a 'ISource*' to a 'SInput*'; conversion from a virtual
    base class is implied"</p>
  </blockquote>
  
  <p>How exactly do I have to set up the inheritance to make this possible?</p>