On 17/01/2017 1:15 AM, Brian wrote:
Dlang should support such coding. What should I do?

import std.stdio : writeln;

abstract class Base(T)
{
    this()
    {
        _this = this;
    }

    void hello()
    {
        _this.world();
    }

    private
    {
        T _this;
    }
}


class Sub : Base!Sub
{
    void world()
    {
        writeln("Hello world");
    }
}

void main()
{
    Sub sub = new Sub;
    sub.hello();
}


FYI, this would have been more appropriate in D.learn instead of the main forum.

import std.stdio;

abstract class Base {
        void hello() {
                world();
        }

        void world();
}

class Sub : Base {
        override void world() {
                writeln("Hello World");
        }
}

void main() {
        Sub sub = new Sub;
        sub.hello();
}

Reply via email to