Sealed classes - would you want them in D?

Walter Bright newshound2 at digitalmars.com
Fri May 11 23:14:43 UTC 2018


On 5/10/2018 6:22 AM, Piotr Mitana wrote:
> For those who never coded Scala and don't know sealed classes: a sealed class is 
> a class which can be only extended in the same source file.
> 
>      sealed class MyClass {}
> 
> Translating to D, a sealed class would could only be extended in the same 
> module.

   private class MyClass { }

should do the trick.


More information about the Digitalmars-d mailing list