Reputation: 397
How i can use = operator overloading in a class in order to assign a value ??
int[4] users;
int someop(string op)(int j){
if(op == "="){
//example
users[j] = j
}
}
Upvotes: 1
Views: 421
Reputation: 19797
It is all in the documentation - https://dlang.org/spec/operatoroverloading.html#assignment ...
For details on how to overload other operators refer to the "Operator Overloading" section of the D Language Specification.
Upvotes: 3