rendered paste bodyGee.HashMap<string,Command> commands;
public class Command : GLib.Object
{
public Command()
{
message( "construct" );
}
~Command()
{
message( "destruct" );
assert_not_reached();
}
}
public Command factory( string name )
{
Command? cmd = commands[name];
assert( cmd != null );
return cmd;
}
void create()
{
commands = new Gee.HashMap<string,Command>();
commands["+FOO"] = new Command();
}
void main()
{
create();
Command cmd = factory( "+FOO" ) as Command;
cmd = null;
Command cmd2 = factory( "+FOO" ) as Command;
cmd2 = null;
}