Give this class: ```d class A { int X() { return x; } int X(int v) { return x = v;}
private int x; } ```I'd like to allow use ```+=```, ```-=``` operators on ```X()``` and keep encapsulation. What's a somehow elegant way to do that?
Jack via Digitalmars-d-learn Mon, 12 Apr 2021 11:20:39 -0700
Give this class: ```d class A { int X() { return x; } int X(int v) { return x = v;}
private int x; } ```I'd like to allow use ```+=```, ```-=``` operators on ```X()``` and keep encapsulation. What's a somehow elegant way to do that?