Override member variables
Gheorghe Gabriel
knoppy273 at live.com
Sat May 19 18:09:56 UTC 2018
I've worked with a lot of programming languages and I've found
something interesting in Kotlin. You can override member
variables. Would you like to have this feature in D?
class Rectangle {
int width = 0;
int height = 0;
}
class Table : Rectangle {
override int width = 10;
override int height = 14;
}
In my opinion it's a more cleaner sintax and you don't need to
put them in constructors. When you look at the Table class
definition/documentation you see that it changes width and height
and their new default values. I am curious about your opinions. :)
And of course, you cannot override private members.
More information about the Digitalmars-d
mailing list