On Monday, August 12, 2019 2:54:56 AM MDT lili via Digitalmars-d-learn wrote: > Hi: > Why need defined an abstract final class? > see > https://github.com/Rikarin/Trinix/blob/master/Kernel/arch/amd64/gdt.d
It's one way to effectively create a namespace using a class. Another way would be to declare the class final, @disable its default constructor, and provide no other constructors. Either way, the result is that the class cannot be instantiated and any static functions declared within the class have to use the class' name when referencing them, whereas if they were free functions within a module, a non-static import would allow you to refer to them directly. For better or worse, std.datetime does it with the class Clock to force the functions for getting the time to all refer to Clock - e.g. Clock.currTime(), whereas if they were directly in the module, it would be possible to do something like currTime(). - Jonathan M Davis