title: C++ Getters-Setters in Implementation File
body: <p>I'm relatively new to C++ and I think that my question may be understood best by example. In my header file, suppose I have</p>
  
  <pre><code>class myClass{
      public:
          double getVar1();
          void setVar1(double newVar1);
          void copyVar1(myClass* dat);
  
      private:
          double var1;
  };
  </code></pre>
  
  <p>In my implementation .cc file, when implementing the copyVar1 method, should I do</p>
  
  <pre><code>void myClass::copyVar1(myClass* dat){
     var1 = dat-&gt;var1;
  }
  </code></pre>
  
  <p>or </p>
  
  <pre><code>void myClass::copyVar1(myClass* dat){
     var1 = dat-&gt;getVar1();
  }
  </code></pre>
  
  <p>where in the second case, I use the getter method instead. Both work properly in Visual C++, but I would like to know which is better to use in practice. </p>
  
  <p>Thank You for your comments!</p>