Skip to content

Instantly share code, notes, and snippets.

@ryanjoneil
Created August 14, 2014 17:00
Show Gist options
  • Save ryanjoneil/bc01478b8fa3752351eb to your computer and use it in GitHub Desktop.
Save ryanjoneil/bc01478b8fa3752351eb to your computer and use it in GitHub Desktop.
subverting private in C++
#include <iostream>
#define private public
#include "foo.hpp"
using namespace std;
int main() {
Foo f(3);
cout << f.bar << endl;
}
class Foo {
private:
int bar;
public:
Foo(int b) : bar(b) {}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment