Using closure in function scope to make "real" private class members

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Wed Jun 8 08:51:14 UTC 2022


On Wednesday, 8 June 2022 at 08:41:36 UTC, Dom Disc wrote:
> But operators tend to really need access to the innards, so 
> most of the time they have to be friends. And there are many 
> operators, hence many friends...

This is something that can be fixed by a dedicated IDE though. So 
this is just syntax.

What you might want to do in C++ is to implement "*=", "+=" etc 
inside the class and then the external operators can be created 
without access to the internals.



More information about the Digitalmars-d mailing list