Problem using Interfce

H. S. Teoh hsteoh at quickfur.ath.cx
Tue May 15 20:12:55 PDT 2012


Gah, I need to proof-read my code before posting. Here's the corrected
version:

 	class Simpson {
 		string name;
 	}
 	class Bart : Simpson {
 		this() {
 			name = "Bart Simpson";
 		}
 	}
 	class Homer : Simpson {
 		this() {
 			name = "Homer Simpson";
 		}
 	}
 
 	void main() {
 		Simpson[] simpsons = [
			new Bart,
			new Homer
		];
 
 		foreach (simpson; simpsons) {
 			writeln(simpson.name);
 		}
 	}
 
 
--T

-- 
My program has no bugs! Only undocumented features...


More information about the Digitalmars-d-learn mailing list