On 20/06/12 22:14, Ali Çehreli wrote:
void main() { Agent[] agents; agents ~= new SmartAgent(); agents ~= new ConfigurableAgent!("int x;", "int y;"); agents ~= new ConfigurableAgent!("double x;", "long y;");foreach (agent; agents) { agent.trade(); } }
Ahh, I hadn't realized that I could create an array whose "type" was the interface -- though it makes sense. Thanks very much!
Is there any way to do this with structs instead of classes? I ask because in my experience the difference in performance is dramatic.
