D snippets

A collection of D (#dlang) code snippets to ruminate on.
 avatarlucdoitlab
Publica year ago1 Snippets
Search
Language
Sort by
📅 Created Date
Order
Property Function is a function that behaves like a variable, that can be got or set. The calling function sets its new value by including it in the caller's argument.
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;
}
  • Total 1 snippets
  • 1