On Fri, 25 Mar 2011 06:18:21 +0100, Ishan Thilina <ishanthil...@gmail.com> wrote:

Hi,

I'm still new to D. I tried to implement a stack using templates. But I get an "Access Violation" error when I try to run a test on the stack that I made.The
source code is attached with this mail. Can somebody please point out the
error of this code?

Line 10:
         Stack! (int) myStack;

Stack!(int) is a class, hence you have to initialize it with new. So this
line should be:

         Stack! (int) myStack = new Stack! (int);

or (perhaps more idiomatic):

         auto myStack = new Stack! (int);


--
Simen

Reply via email to