Another problem with properties
Aarti_pl
aarti at interia.pl
Fri Aug 24 01:52:21 PDT 2007
Below examples doesn't compile, but IMHO they should. Especially when
properties are threated as functions like in D...
//--------------------
//Example A
//You can not make sure that every class will have some property
interface I {
int prop;
}
class Test : I {
int prop;
}
//--------------------
//Example B
//When you define property as functions you have to use them in every
//derived class
interface I {
int prop();
void prop(int);
}
class Test : I {
int prop;
}
//--------------------
//Example C
//You can not extend property in derived function
interface I {
int prop;
}
class Test : I {
int prop();
void prop(int);
}
//--------------------
Above examples *should* work. Current behavior reduces properties
usefulness.
BR
Marcin Kuszczak
(Aarti_pl)
More information about the Digitalmars-d
mailing list