title: C++ Constructor setting value
body: <p>I am trying to write a constructor in C++ (I am new).</p>
  
  <p>My Attempt:</p>
  
  <pre><code>class Tree
  {
      private:
          int leaf;
  
      public:
          Tree(int leaf); //constructor
  };
  
  Tree::Tree(int leaf) //constructor
  {
  strcpy(this-&gt;leaf, leaf);
  }
  </code></pre>
  
  <p>Is this the proper way how to do it? Since I found many different version with srcpy, without , etc.</p>