Sealed classes - would you want them in D? (v2)
Neia Neutuladh
neia at ikeran.org
Sat May 19 17:05:58 UTC 2018
On Saturday, 19 May 2018 at 04:01:18 UTC, KingJoffrey wrote:
> Mmm.. that brings me back to the idea of sealed at the class
> level again.
>
> class A
> {
> private int x;
> private(this) int y; // imagine if you have lots of private
> variables.
> // this could become pretty anoying -
> and kinda redundant.
> }
All attributes in D work the same way. You can write things like:
class A
{
@Jsonize:
private:
int a;
string b;
protected
{
long c;
}
@safe:
void privateSafeFunction() {}
void otherPrivateSafeFunction() {}
}
Perhaps you should learn more about the language before proposing
specific changes?
More information about the Digitalmars-d
mailing list