Skip to content

Instantly share code, notes, and snippets.

@hdznrrd
Last active August 29, 2015 14:19
Show Gist options
  • Save hdznrrd/274c5a512f7875483391 to your computer and use it in GitHub Desktop.
Save hdznrrd/274c5a512f7875483391 to your computer and use it in GitHub Desktop.
$ echo "++HEADER";cat test.h; echo "++IMPL"; cat test.cpp;(CXXFLAGS=--std=c++11 make test && ./test)
++HEADER
#ifndef _TEST_H_
#define _TEST_H_
class foo {
public: foo(int a=1);
};
#endif
++IMPL
#include "test.h"
#include <iostream>
foo::foo(int a/*=1*/) {
std::cout << a << std::endl;
}
int main(int argc, char** argv) {
foo();
foo(2);
return 0;
}
g++ --std=c++11 test.cpp -o test
1
2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment