Non-ugly ways to implement a 'static' class or namespace?

Ruby The Roobster rubytheroobster at yandex.com
Fri Jan 20 12:59:01 UTC 2023


On Friday, 20 January 2023 at 12:55:37 UTC, Ruby The Roobster 
wrote:
> On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear ...
>
> There is no way to implement that functionality in D.  `final` 
> means that the class cannot be extended, and `abstract` 
> requires that only an extension of said class can be 
> instantiated.  However, unlike in Java and C#, you cannot call 
> a function without instantiating said class, as functions act 
> on the class object.

Also, there is a `static` keyword, but a `static class` can be 
instantiated as a member of the external class.


More information about the Digitalmars-d-learn mailing list