title: public fields or C# like properties in C++?
body: <p>Alright so I'm trying to creating something that is sort of like the properties in C# for my classes in C++.</p>
  
  <p>for example. in C# i would do this:</p>
  
  <pre><code>int MaxHP { get; set; }
  </code></pre>
  
  <p>or, with backing field: </p>
  
  <pre><code>int MaxHP 
  { 
      get { return maxHP; }
      set { maxHP = value; }
  }
  </code></pre>
  
  <p>However so far with C++, I've only been able to replicate this with:</p>
  
  <pre><code>private:    
      int maxHP;  
      int maxEP;
  public:
      int GetMaxHP() { return maxHP; }
      void UpSetMaxHP(int value){ maxHP += value; }
      void DownSetMaxHP(int value){ maxHP -= value; }
      int GetMaxEP(){ return maxEP; }
      void UpSetMaxEP(int value){ maxEP += value; }
      void DownSetMaxEP(int value){ maxEP -= value; }
  </code></pre>
  
  <p>I must be missing something in the way things should be designed. In C# the property would be access like a field. however in C++ I have to do functions which work differently when accessed from other objects.</p>
  
  <p>I guess i could do:</p>
  
  <pre><code>public:
      int MaxHP;
  </code></pre>
  
  <p>But that feels like I am sort of defeating the purpose. So my question is, Am i doing this right or is there a better, proper way of achieving this?</p>