@porperty problem..

BLS windevguy at hotmail.de
Mon Jun 28 14:06:46 PDT 2010


On 28/06/2010 22:58, Steven Schveighoffer wrote:
> I wasn't aware that @property implies auto.  I guess that makes sense,
> but I didn't consider it anything but a hint to the compiler about how
> it could be called, not that did anything with the type.

Hm,  this snippet does not compile :
class Server {
	private string _name, _id;

	@property servername(string name) {
		_name = name;
	}
	@property string servername() {
		return _name;
	}
}

remove string from @property and it works.

On the other hand ..
	@property Server nextServer() {
		return servers[0];
	}
compiles fine !
Guess we need the official documents...
Bjoern


More information about the Digitalmars-d-learn mailing list