Skip to content

Instantly share code, notes, and snippets.

@siritori
Created May 24, 2012 15:09
Show Gist options
  • Save siritori/2782131 to your computer and use it in GitHub Desktop.
Save siritori/2782131 to your computer and use it in GitHub Desktop.
hoge
#include <iostream>
using namespace std;
typedef enum {
ATOMIC,
NOT,
AND,
OR,
IMPLIES,
} PropType;
class Prop {
public:
Prop() {}
virtual PropType type();
};
class AtomicProp : private Prop {
const char ch_;
public:
AtomicProp(const char ch):ch_(ch){}
PropType type() const {
return ATOMIC;
}
friend ostream &operator<<(ostream &stream, AtomicProp &p);
};
ostream& operator<<(ostream &stream, AtomicProp &p) {
stream << p.ch_;
return stream;
}
int main(void) {
AtomicProp p('A');
cout << p << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment