Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #774 from AndrejMitrovic/Fix3093
Browse files Browse the repository at this point in the history
Issue 3093 - Add better documentation for Object.factory and add an example
  • Loading branch information
dnadlinger committed Apr 23, 2014
2 parents 39dd0fd + 30da736 commit 6f9dc73
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/object_.d
Expand Up @@ -123,11 +123,28 @@ class Object
}

/**
* Create instance of class specified by classname.
* Create instance of class specified by the fully qualified name
* classname.
* The class must either have no constructors or have
* a default constructor.
* Returns:
* null if failed
* Example:
* ---
* module foo.bar;
*
* class C
* {
* this() { x = 10; }
* int x;
* }
*
* void main()
* {
* auto c = cast(C)Object.factory("foo.bar.C");
* assert(c !is null && c.x == 10);
* }
* ---
*/
static Object factory(string classname)
{
Expand Down

0 comments on commit 6f9dc73

Please sign in to comment.