What the abstrac final class mean?

a11e99z black80 at bk.ru
Mon Aug 12 09:25:17 UTC 2019


On Monday, 12 August 2019 at 09:16:19 UTC, Alex wrote:
> On Monday, 12 August 2019 at 08:54:56 UTC, lili wrote:
>> Hi:
>>     Why need defined an abstract final class?
>>     see  
>> https://github.com/Rikarin/Trinix/blob/master/Kernel/arch/amd64/gdt.d
>
> From what I saw, all members are static. So, this is a kind of 
> utility class, which is not supposed to be instantiated, nor to 
> be derived from. Maybe, it serves like a namespace, for 
> convenience...

its weird that next compiles in some weird form

import std;
static class A {
     static a() { "a".writeln; } // forgot return type
}
void main() {
     A.a();

     A b, c; // 2 instances with diff addr
     "%s %s".writefln( &b, &c );
}

// and for static struct DMD gives to A size 1b, LDC - 8b


More information about the Digitalmars-d-learn mailing list