Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. [test.h]
  2.  
  3. enum Pawn {
  4. YELLOW = 1, RED = 2
  5. };
  6.  
  7.  
  8. class test {
  9. public:
  10. test();
  11. Pawn* getPawn();
  12. void setPawn(Pawn&);
  13. virtual ~test();
  14. private:
  15. Pawn* pion;
  16. };
  17.  
  18. [test.cpp]
  19.  
  20. test::test() {
  21. *pion = RED;
  22. }
  23.  
  24. Pawn* test::getPawn() {
  25. return (pion);
  26. }
  27.  
  28. void test::setPawn(Pawn& p) {
  29. //pion* = p;
  30. }
  31.  
  32.  
  33. [main.cpp]
  34.  
  35. int main() {
  36. test toto = test();
  37. if (*(toto.getPawn()) == RED) {
  38. std::cout << "test1" << endl;
  39. }
  40. else {
  41. std::cout << "test2" << endl;
  42. }
  43. cout << flush;
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement