Created
May 24, 2012 15:09
-
-
Save siritori/2782131 to your computer and use it in GitHub Desktop.
hoge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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