Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [test.h]
- enum Pawn {
- YELLOW = 1, RED = 2
- };
- class test {
- public:
- test();
- Pawn* getPawn();
- void setPawn(Pawn&);
- virtual ~test();
- private:
- Pawn* pion;
- };
- [test.cpp]
- test::test() {
- *pion = RED;
- }
- Pawn* test::getPawn() {
- return (pion);
- }
- void test::setPawn(Pawn& p) {
- //pion* = p;
- }
- [main.cpp]
- int main() {
- test toto = test();
- if (*(toto.getPawn()) == RED) {
- std::cout << "test1" << endl;
- }
- else {
- std::cout << "test2" << endl;
- }
- cout << flush;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement