Is defining get/set methods for every field overkill?

thebluepandabear therealbluepandabear at protonmail.com
Sat Nov 19 04:04:12 UTC 2022


If you only want to add setters:

```
class Rect2D {
     int _width;
     int _height;

     void width(int width) {
         writeln("SET");
         this._width = width;
     }

     void height(int height) {
         writeln("SET");
         this._height = height;
     }
}
```



More information about the Digitalmars-d-learn mailing list