fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. #include <map>
  4. using namespace std;
  5.  
  6. class Employee {};
  7. class A: public Employee {};
  8. class B: public Employee {};
  9. class C: public Employee {};
  10. typedef Employee *makeEmployee();
  11.  
  12. map<string,makeEmployee*> maker
  13. {
  14. {"A",[]()->Employee*{ return new A(); }},
  15. {"B",[]()->Employee*{ return new B(); }},
  16. {"C",[]()->Employee*{ return new C(); }},
  17. };
  18.  
  19. int main()
  20. {
  21. Employee *tmp=maker["A"]();
  22. return 0;
  23. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
Standard output is empty