Useful in class/struct declarations for DRY.
Generates a public getter, private setter, and a hidden private var.
Usage:
mixin(getter!(int, "myVar")); mixin(getter!("protected", float, "someFloat", 2.5)); mixin(getter!(string, "str"));
Turns Into:
private int _myVar; @property private int myVar(int _NEW_VAL_) { _myVar = _NEW_VAL_; return _myVar; } @property public int myVar() { return _myVar; } protected float _someFloat = 2.5; @property protected float someFloat(float _NEW_VAL_) { _someFloat = _NEW_VAL_; return _someFloat; } @property public float someFloat() { return _someFloat; } private string _str; @property private string str(string _NEW_VAL_) { _str = _NEW_VAL_; return _str; } @property public string str() { return _str; }
See Implementation
Useful in class/struct declarations for DRY.
Generates a public getter, private setter, and a hidden private var.
Usage:
Turns Into: