All pastes #923965 Raw Edit

Unnamed

public cpp v1 · immutable
#923965 ·published 2008-02-29 23:50 UTC
rendered paste body
#include <iostream>#include <list>using namespace std;template<typename T>struct Command{    virtual T Execute() = 0;};struct GetNamesCommand : public Command<list<string> >{    list<string> Execute()    {        list<string> a;        a.push_back( "one" );        a.push_back( "two" );        a.push_back( "three" );        return a;    }};template<typename T>T ExecuteCommand( Command<T>& command ){    return command.Execute();}int main( void ){    GetNamesCommand gnc;    list<string> names = ExecuteCommand( gnc );    for( list<string>::iterator i = names.begin(); i != names.end(); ++i )    {        cout << i->c_str() << endl;    }}