title: C++ Inheritance with pure virtual functions
body: <p>I'm trying to create a class that serves as a base object, which will then be sub-classed (=implemented) to serve various purposes.</p>
  
  <p>I want to define one or more pure virtual functions, so that however subclasses the base class, is required and does not forget to implement them.</p>
  
  <p>There is one caveat, the pure virtual function's signature includes the type of the base object. Once sub-classed, the function definition doesn't match the base classes definition anymore of course. E.g.:</p>
  
  <pre><code>class BaseItem 
  {
  public:
      virtual std::string getDifferences(const BaseItem&amp; item) = 0;
  }
  </code></pre>
  
  <p>So, in the derived class I'd like to do:</p>
  
  <pre><code>class DerivedClass : public BaseItem
  {
  public:
      virtual std::string getDifferences(const DerivedClass&amp; item) = 0;
  private:
      std::string derivedItemCustomObject;
  }
  </code></pre>
  
  <p>which of course the compiler won't accept. I could make it a <code>BaseItem</code> of course, but then I can't utilize any objects in the derived class.</p>
  
  <p>Do I have to use casting to accomplish this?</p>
  
  <p>Please let me know if my intent/question is not clear.</p>