fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. class foo{
  5. public:
  6. foo(const string &name):
  7. name_(name)
  8. {};
  9.  
  10. void print(){
  11. cout << name_ << endl;
  12. }
  13. private:
  14. string name_;
  15. };
  16.  
  17. #define CREATE_FOO(name) foo name(#name)
  18.  
  19. int main() {
  20. // your code goes here
  21. CREATE_FOO(baz);
  22. baz.print();
  23. return 0;
  24. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
baz