Class templates with types determined at runtime

grauzone none at example.net
Tue Apr 7 22:34:34 PDT 2009


Not sure what you're actually trying to do, but you can do this:

class Container {
	abstract void dostuff();
}

class ContainerSDgsdg(T) : Container {
	override void dostuff() {
		//can use T here
	}
}

Container bla = new ContainerSDgsdg!(int)();
//can pass around "bla" freely, because class Container is not
//templated! the actual class is, but this doesn't matter.
bla.stuff();


More information about the Digitalmars-d-learn mailing list