@property and interfaces

BLS windevguy at hotmail.de
Tue Jun 29 03:29:31 PDT 2010


sorry for making so much noise.. figured it out by myse4lf.
interface IBindingList {
		
	@property bool AllowEdit();
	//@property bool AllowEdit(bool enable);
	//remove // to enable setter
}

class A : IBindingList {
	private bool _allowEdit;

	@property {
		bool AllowEdit() { return _allowEdit;	}
		//bool AllowEdit(bool enable) { return _allowEdit = enable; }
	}	
}
bjoern

On 29/06/2010 12:11, BLS wrote:
> Just wonder how to translate this C# snippet into D..
> //C#
> public interface IBindingList {
>
> bool AllowEdit {
> get;
> }
> }
>
> //D2
> interface IBindingList {
>
> @property bool allowEdit();
> }
>
> Is this correct ? I think in C# AllowEdit() takes tare that you don't
> implement a setter. Seems to be impossible in D.
>
> Thanks Bjoern



More information about the Digitalmars-d-learn mailing list