On Tuesday, 5 July 2016 at 10:52:10 UTC, zodd wrote:
Property functions are used wrong by a compiler when it needs

i am sorry for my dumbness, what wrong with this code?

import std.stdio;

struct A {
    @property ref int value() {
        return value_;
    }

    @property void value(int v) {
        value_ = v;
    }

private:
        int value_;
}

int main(string[] args) {
        A a;
        a.value = 10;
        writeln(a.value);
        a.value += 20;
        writeln(a.value);
        return 0;
}

Reply via email to