"Hello D-world!", imports & South African D-naughts

Bosak bosak at gmail.com
Sat Aug 3 02:24:24 PDT 2013


"The D Programming Language" is kind of old and out of date for
the current version of D. There aren't many books for D so you
have not much choice.
Attributes can be declared with 3 different syntaxes. For
example one could write:
//--1--
/*Explicitly state attribute before every declaration*/
public int number;
public string name;
//--2--
/*State the attribute and then curly brackets and all the
declarations inside have the attribute specified. Also note
that those brackets don't introduce a new scope*/
public
{
     int number;
     string name;
}
//--3--
/*Use C++ style atributes. All the declarations after the 
attribute declaration have the attribute. If you declare another 
attribute the same way after that, then the old attribute is 
replaced with the new one for the declarations that follow*/
public:
     int number;
     string value;
private:
     //everything below is private


More information about the Digitalmars-d-learn mailing list