Remix.run Logo
jayd16 2 days ago

If all you're doing is accessing public members, sure.

nicwilson 2 days ago | parent | next [-]

`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 2 days ago | parent | prev [-]

It works for all functions that have parameters, `f(a)` and `a.f()` are equivalent.

jayd16 2 days ago | parent [-]

Yes, but I presume that f() cannot access private members of a.

WalterBright 2 days ago | parent [-]

That's correct.