Skip to content

Instantly share code, notes, and snippets.

@Rayer
Last active August 29, 2015 14:12
Show Gist options
  • Save Rayer/b75c5d4c1768d231631e to your computer and use it in GitHub Desktop.
Save Rayer/b75c5d4c1768d231631e to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <typeinfo>
using namespace std;
class foo {
std::string name;
public:
foo();
std::string getName();
};
foo::foo() : name(typeid(*this).name()) {
}
std::string foo::getName() {
return name;
}
int main(int argc, char *argv[]) {
foo f;
std::cout << f.getName();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment