What is the "Final"?

RuZzz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 20 03:58:32 PST 2015


Alexandrescu "The_D_Programming_Language"
page 264: 7.1.10 Subtyping with structs. The @disable Attribute
import std.stdio;
...
unittest {
auto a = Final!Widget(new Widget);
a.print(); // Fine, just print a
auto b = a; // Fine, a and b are bound to the same Widget
a = b; // Error!
// opAssign(Finai!Widget) is disabled!
a = new Widget; // Error!
// Cannot assign to rvatue returned by get()!
}

What is the "Final" in the code?


More information about the Digitalmars-d-learn mailing list