Re: What the abstrac final class mean?

2019-08-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, August 13, 2019 3:03:49 AM MDT Jacob Carlborg via Digitalmars-d- learn wrote: > On 2019-08-12 11:25, a11e99z wrote: > > its weird that next compiles in some weird form > > > > import std; > > static class A { > > > > static a() { "a".writeln; } // forgot return type > > > > } > > S

Re: What the abstrac final class mean?

2019-08-13 Thread Jacob Carlborg via Digitalmars-d-learn
On 2019-08-12 11:25, a11e99z wrote: its weird that next compiles in some weird form import std; static class A {     static a() { "a".writeln; } // forgot return type } Since you have specified an attribute on "a", the compiler can infer the return type. In this case it's inferred to "void"

Re: What the abstrac final class mean?

2019-08-12 Thread Jonathan M Davis via Digitalmars-d-learn
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.

Re: What the abstrac final class mean?

2019-08-12 Thread a11e99z via Digitalmars-d-learn
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

Re: What the abstrac final class mean?

2019-08-12 Thread Alex via Digitalmars-d-learn
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

What the abstrac final class mean?

2019-08-12 Thread lili via Digitalmars-d-learn
Hi: Why need defined an abstract final class? see https://github.com/Rikarin/Trinix/blob/master/Kernel/arch/amd64/gdt.d

Re: final class & final methods

2015-09-25 Thread Mike Parker via Digitalmars-d-learn
On Friday, 25 September 2015 at 10:28:56 UTC, ref2401 wrote: If I declare a class as `final` do I have to mark all methods of the class as `final` too? A final class can't be subclassed, so none of its methods can be overridden anyway.

Re: final class & final methods

2015-09-25 Thread Marco Leise via Digitalmars-d-learn
Am Fri, 25 Sep 2015 10:28:54 + schrieb ref2401 : > If I declare a class as `final` do I have to mark all methods of > the class as `final` too? No. -- Marco

final class & final methods

2015-09-25 Thread ref2401 via Digitalmars-d-learn
If I declare a class as `final` do I have to mark all methods of the class as `final` too?

Re: Final class and interface

2014-03-03 Thread Steven Schveighoffer
On Mon, 03 Mar 2014 21:48:16 -0500, Casper Færgemand wrote: Is there any loss in performance instantiating an interface variable as a final class implementing only that interface, as opposed to a class variable? You mean the difference between: final class C : I {...} // this I i

Final class and interface

2014-03-03 Thread Casper Færgemand
Is there any loss in performance instantiating an interface variable as a final class implementing only that interface, as opposed to a class variable?

Re: Final class

2013-07-11 Thread Daniel Kozak
On Friday, 12 July 2013 at 05:13:44 UTC, Jonathan M Davis wrote: On Friday, July 12, 2013 07:03:07 Daniel Kozak wrote: Are all methods in final class non-virtual or must be explicity marked as a final too? They're virtual if they override base class functions, but they're defi

Re: Final class

2013-07-11 Thread Jonathan M Davis
On Friday, July 12, 2013 07:03:07 Daniel Kozak wrote: > Are all methods in final class non-virtual or must be explicity > marked as a final too? They're virtual if they override base class functions, but they're definitely all final. So, the compiler _should_ optimize the func

Final class

2013-07-11 Thread Daniel Kozak
Are all methods in final class non-virtual or must be explicity marked as a final too?

Re: private final class destructors

2010-08-19 Thread Jonathan M Davis
On Thursday, August 19, 2010 08:23:42 Simen kjaeraas wrote: > A destructor is always final, and private destructors make no sense, > so I would say the attributes should not be there. Actually, I could see private destructors making at least some sense. Obviously, the runtime needs to be able to

Re: private final class destructors

2010-08-19 Thread bearophile
Simen kjaeraas: > A destructor is always final, and private destructors make no sense, > so I would say the attributes should not be there. Thank you for your answer, I have added the test case to bug 3934 Bye, bearophile

Re: private final class destructors

2010-08-19 Thread Simen kjaeraas
bearophile wrote: According to TDPL the whole object destructor chain is called up to the top of the hyerarchy. This D2 program compiles and runs with DMD 2.048 with no errors: import std.c.stdio: puts; class Base { private final ~this() { puts("Base.~this"); } } class Derived : Base {

private final class destructors

2010-08-19 Thread bearophile
According to TDPL the whole object destructor chain is called up to the top of the hyerarchy. This D2 program compiles and runs with DMD 2.048 with no errors: import std.c.stdio: puts; class Base { private final ~this() { puts("Base.~this"); } } class Derived : Base { private final ~thi