title: cannot call member function 'Image* Source::GetOutput()' without object, cannot make it static
body: <p>I have a class defined as such:</p>
  
  <pre><code>// source.C
  
  #include "source.h"
  
  Image* Source::GetOutput()
  {
      return this-&gt;img;
  }
  
  
  
  
  // source.h
  
  #include "image.h"
  
  #ifndef SOURCE_H
  #define SOURCE_H
  
  class Source
  {
      private:
          Image* img;
      public:
          Image* GetOutput(); 
          virtual void Execute()=0;
  };
  #endif
  </code></pre>
  
  <p>I need to call <code>Image img = *Sink::GetOutput();</code> or something to that effect in a subclass of <code>Source</code> . However, that raises the errror <code>cannot call member function ‘Image* Source::GetOutput()’ without object</code>. I know that I could make <code>GetOutput()</code> static to get rid of this error, but then I would no longer be able to return <code>this-&gt;img;</code>. Is there any way I can modify this code to have the intended purporse?</p>