Sam Hu Wrote:
>
> In below code snippet:
>
> class Dog
> {
> public void bark(){}
> }
> int main(string[] args)
> {
> auto obj=Object.factory("Dog");
> Dog doggie=cast(Dog)obj;
> doggie.bark;
>
> return 0;
> }
>
> Compiled successfully but failed when run:
> Object.Error:Access Violation.
>
> I also tried ClassInfo.find(string classname),ClassInfo.create() but caused
> the same error.
>
Object.factory requires a fully qualified class name, so if class Dog resides
in module animals, call Object.factory("animals.Dog").