[CTRL++] Initialize member variable in the constructor


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();  }};

Date added:
Last revised:
Rating: 4.3. 29 vote(s). No rating done at all.
Your vote was '' (0 of 5) Your are an anonymous user.
You may log on to do personalized votings
Click the rating bar to rate this item Please log on to do ratings
Programming / Scripting, OOP