On Tuesday, 27 October 2015 at 05:36:58 UTC, liumao wrote:
for example
    class A;
    {
        void doSomething() {}
    }

    A *a = cast(A *) new A;

    then I call a.doSomething(); my program "Segmentation fault"



how could it happened? and how i use it correctly?


3q, please tell me, 3q 3q 3q!!!!!

`A` on its own is already a reference type. `A*` is a pointer to a class reference, i.e. a pointer to a pointer, like `A**` in C++.

http://wiki.dlang.org/Coming_From/C_Plus_Plus#Slicing_problem

Please use D.learn for questions like this in the future.

Reply via email to