segmentation fault with Object.factory()

berni via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Feb 19 02:06:41 PST 2017


I get a segmentation fault, when I run this program:

>void main()
>{
>    A bar = cast(A)Object.factory("AA");
>    bar.foo();
>}
>
>class A    { abstract void foo(); }
>class AA:A { override void foo() {} }

The call of bar.foo() is, where the segmentation fault occurs. 
When I use A bar = new AA(); instead of the factory it works.

What's wrong here?


More information about the Digitalmars-d-learn mailing list