Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
jayd16
· 1y ago · 0 comments
If all you're doing is accessing public members, sure.
Comments
[–]
nicwilson
1y ago
`private` is only private to the module, not the struct/class, (In other words, all functions in the same module are all C++ style `friend`s) and so free function in same module work.
[–]
WalterBright
1y ago
It works for all functions that have parameters, `f(a)` and `a.f()` are equivalent.
[–]
jayd16
OP
1y ago
Yes, but I presume that f() cannot access private members of a.
[–]
WalterBright
1y ago
That's correct.