Unbenanntes Dokument
https://portal.etm.at/index.php?=creative-writing-lesson-plans-elementary/
creative writing activities poetry | homework help students learn
-->
Home ETM FAQ Tips & Tricks [CTRL++] Use private member variables and public access methods

Email Print

[CTRL++] Use private member variables and public access methods

Date added:
Wednesday, 23 May 2018
Last revised:
Wednesday, 30 May 2018
Hits:
460
Rating:
 
Vote for this:
Good - Bad

Answer

Classes often have values to save, it is not recommended to have the access to those values public, getter and setter methods shall be used to access those values. In the setter method It can be checked if the values given are allowed (input checks).

Class A
{
  private int a;
  public void A() { a = 0; }
  public void setA(const int iInput) { this.a = iInput; }
  public int getA() { return this.a; }
};

Keywords for this item

Keywords

1 items are tagged with 3.12   1 items are tagged with 3.13   1 items are tagged with 3.14   1 items are tagged with 3.15   1 items are tagged with ALL Versions   1 items are tagged with Engineering   1 items are tagged with Installation / Configuration   4 items are tagged with OOP   6 items are tagged with Programming / Scripting   1 items are tagged with PVSS   2 items are tagged with WinCC Open Architecture   1 items are tagged with Windows  

Search FAQ


            Forgot login? | homework help students learn