C++ Getter/Setter (Alternatives?)
<p>Okay, just about everywhere I read, I read that getters/setters are "evil". 
Now, as a programmer who uses getters/setters often in PHP / C#, I do not see how they are alive. I have read that they break encapsulation, etc etc, however, here is a simple example.</p>

<pre><code>class Armor{

  int armorValue;
public:
  Armor();
  Armor(int); //int here represents armor value
  int GetArmorValue();
  void SetArmorValue(int);
};
</code></pre>

<p>Now, lets say getters and setters are "evil".
How are you supposed to change a member variable after initialization.</p>

<p>Example:</p>

<pre><code>Armor arm=Armor(128); //armor with 128 armor value

//for some reason I would like to change this armor value
arm.SetArmorValue(55); //if i do not use getters / setters how is this possible?
</code></pre>

<p>Lets say the above is not okay, for whatever reason.
What if  my game restricts armor values from 1 to 500. (No armor can have a piece that has more than 500 armor or less than 1 armor).</p>

<p>Now my implementation becomes</p>

<pre><code>void Armor::SetArmor(int tArmValue){
      if (tArmValue&gt;=1 &amp;&amp; tArmValue&lt;=500)
         armorValue=tArmValue;
      else
         armorValue=1;
}
</code></pre>

<p>So, how else would I impose this restriction without using getters/setters?
How else would I modify a property without using getters/setters?
Should armorValue just be a public member variable in case 1, and the getters/setters used in case 2?</p>

<p>Curious. THanks guys</p>
