fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5. struct AskBase
  6. {
  7. };
  8.  
  9. template <typename T>
  10. struct Ask : public AskBase
  11. {
  12. Ask (const std::string&, int, int)
  13. {
  14. }
  15. };
  16.  
  17. struct AskUI
  18. {
  19. std::vector <AskBase*> questions ;
  20.  
  21. AskUI (const std::vector <AskBase*> &questions) : questions (questions)
  22. {
  23. }
  24. };
  25.  
  26. int main()
  27. {
  28. AskUI askUI {{
  29. new Ask <std::string>{"Enter your name: ", 3, 25},
  30. new Ask<std::string>{"Enter your city: ", 2, 25},
  31. new Ask<std::string>{"Enter your state: ", 2, 2},
  32. new Ask<int> {"Enter your age: ", 18, 120}
  33. }} ;
  34.  
  35. return 0;
  36. }
  37.  
  38.  
Success #stdin #stdout 0s 3224KB
stdin
Standard input is empty
stdout
Standard output is empty