struct Foo
{
@property int data() { return m_data; } // read property
@property int data(int value) { return m_data = value; } //
write property
private: int m_data;
}
It would be nice if properties had an internal variable to use
instead of having to declare it explicitly:
struct Foo
{
@property int data() { return data.value; } // read property
@property int data(int value) { return data.value; } // write
property
}
This reduces code complexity. If a property does not use the
internal variable(which I signify by .value) then it does not add
any storage. This allows one to easily wrap fields into
properties without having to create private fields for each
property unless needed.