title: Declaring variable inside functions of a class in C++
body: <p><strong>MyFill</strong> is a class and <strong>MyFill2</strong> is a function inside that class.</p>
  
  <p>What is the difference in between declaring a variable inside public function of the class like this (thickness and lineType) --></p>
  
  <pre><code>MyFill::MyFill (Mat img, Point center)
  {
      MyFill2 (img, center);
  }
  
  void MyFill::MyFill2(Mat img, Point center)
  {
      int thickness = -1;
      int lineType = 8;
      circle (
          img,
          center,
          w/32,
          Scalar( 0, 0, 255 ),
          thickness,
          lineType
      );
  }
  </code></pre>
  
  <p>...and just declaring them in private label (private:), like in the header file --></p>
  
  <pre><code>class MyFill {
  public:
      MyFill(Mat img1, Point center1);
      void MyFill2 (Mat img, Point center);
  private:
      int thickness = -1;
      int lineType = 8;
  };
  </code></pre>
  
  <p>The first one works right. But the second one doesn't. If I want to go with the second option, what I need to do? A right code with some explanation might help.</p>