Static class question

Lubos Pintes lubos.pintes at gmail.com
Thu Feb 14 04:49:03 PST 2013


Hi,
I saw one ListBox class implementation.
As we all know, ListBox class collects and displays strings. Author 
decided that he encapsulate the Object as item, and uses its toString() 
method when string is needed for display.
For cases when string is added, he defined this small class, internal to 
ListBox:
[code]
	private static class StringItem
	{
		private string _str;

		public this(string s)
		{
			this._str = s;
		}

		public override string toString()
		{
			return this._str;
		}
	}
[/code]

After I read about attributes on dlang, I think the static could be 
removed from above definition. Is this true?
Thank


More information about the Digitalmars-d-learn mailing list