Easy way to implement interface properties?
Jacob Carlborg
doob at me.com
Wed Jan 1 04:09:39 PST 2014
On 2014-01-01 01:52, Frustrated wrote:
> Is there an easy way to implement properties of an interface within a
> class instead of having to duplicate almost the exact same code with
> generic properties?
>
> interface A
> {
> @property int data();
> @property int data(int value);
>
> }
>
> class B : A
> {
> @property int data() { return m_data; } // read property
> @property int data(int value) { return m_data = value; } // write
> property
> }
You can't use an abstract class?
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list