Unbenanntes Dokument
how you would go about developing a creative writing activity
eca new haven creative writing | creative writing styles and techniques
-->
Home ETM FAQ Tips & Tricks [CTRL++] Initialize member variable in the constructor

Email Print

[CTRL++] Initialize member variable in the constructor

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

Answer

 

Initializing values in the constructor is faster than setting them afterwards with setter methods or when defining the variable.

struct S()
{
  //instead of this, use the constructor
  //private b = calcValue();
  private b;

  public S()
  {
    b = calcValue();
  }
};

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? | creative writing styles and techniques