title: 'this' pointer, inheriting functions of super class in subclass using 'this' pointer
body: <p>Hi i am trying to understand how to use the 'this' pointer. Now i wrote a sample program which uses a class Image which is a subclass of a class BMP. Now the functions TellWidth and TellHeight are declared in the BMP class. Now the compiler gives me an error which says that the TellWidth function does not exist in Image. But as Image is a subclass of BMP shouldnt it inherit the functions in BMP. 
  How do i resolve this </p>
  
  <pre><code>void Image :: invertcolors()
  {
      int x;
      int y;
  
      int width  =(*this).TellWidth();
      int height = (*this)-&gt;TellHeight();
  
      for(x=0,x&lt;=height-1;x++){
          for(y=0,y&lt;=width-1;y++){
              (*this)(x,y)-&gt;Red = (255 - (*this)(x,y)-&gt;Red);
              (*this)(x,y)-&gt;Blue = (255 - (*this)(x,y)-&gt;Blue);
              (*this)(x,y)-&gt;Green = (255 - (*this)(x,y)-&gt;Green);
  
          }
      }
      delete width;
      delete height;
  }
  </code></pre>
  
  <p>Image</p>
  
  <pre><code>class Image : public BMP  
  {
  public:
  
      void invertcolors();
  
      void flipleft();
      void adjustbrightness(int r, int g, int b) ;
  
  };
  </code></pre>
  
  <p>This class is too big to post here, here is a relavent excerpt</p>
  
  <pre><code>class BMP {
  private:
     int Width;
     int Height;
  public:
     int TellBitDepth(void) const;
     int TellWidth(void) const;
     int TellHeight(void) const;
  };
  </code></pre>