Skip to content

Instantly share code, notes, and snippets.

@atilaneves
Created August 23, 2019 11:03
Show Gist options
  • Save atilaneves/2d3db10f19fc96a5bb01e15ae891250d to your computer and use it in GitHub Desktop.
Save atilaneves/2d3db10f19fc96a5bb01e15ae891250d to your computer and use it in GitHub Desktop.
UFCS
import mod;
struct Public {
int oops() {
return 42;
}
}
struct Nope {
}
int oops(T)(T obj) {
return 33;
}
void main() {
auto pub = Public();
auto nop = Nope();
assert(pub.oops == 42);
assert(nop.oops == 33);
}
struct Private {
private int oops() {
return -1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment