Website Summary Files Commits Branches @commit @diff @stats
path: root / DiamondProblemAndPolymorphism / Chess / Rook.hpp
diff options
context:
space:
mode:
Commite82491b4c5331dcd854a446df01a9c76c0e50369 (patch)
Author
 Angeld55 <achi_d@abv.bg>
2019-09-21 12:08:32 +0300
Committer
 GitHub <noreply@github.com>
2019-09-21 12:08:32 +0300
Files08b4e1e4cadc71eaa693c6cb9698b56f88a8ed95 /DiamondProblemAndPolymorphism/Chess/Rook.hpp
Object-oriented_programming_FMI-e82491b4c5331dcd854a446df01a9c76c0e50369.tar
Object-oriented_programming_FMI-e82491b4c5331dcd854a446df01a9c76c0e50369.tar.gz
Object-oriented_programming_FMI-e82491b4c5331dcd854a446df01a9c76c0e50369.zip
Parenta465139e88facd7cfca916e1c116382e88e2bb4b (diff)
Add files via upload
1 files changed, 30 insertions, 0 deletions
-rw-r--r--DiamondProblemAndPolymorphism/Chess/Rook.hpp30
diff --git a/DiamondProblemAndPolymorphism/Chess/Rook.hpp b/DiamondProblemAndPolymorphism/Chess/Rook.hpp
new file mode 100644
index 0000000..576920a
--- /dev/null
+++ b/DiamondProblemAndPolymorphism/Chess/Rook.hpp
@@ -0,0 +1,30 @@
+#include "Figure.hpp"
+
+class Rook : virtual public Figure
+{
+
+public:
+ Rook(int xCoordinate, int yCoordinate, bool isWhite) :Figure(xCoordinate, yCoordinate, isWhite)
+ {}
+
+ bool Move(int xNew, int yNew);
+
+ void Print();
+
+};
+
+bool Rook::Move(int xNew, int yNew);
+{
+ if (!isValidCoord(xNew, yNew))
+ return false;
+ if (!(xCoord == xNew ^ yCoord == yNew))
+ return false;
+ xCoord = xNew;
+ yCoord = yNew;
+ return true;
+}
+
+void Rook::Print()
+{
+ cout << 'R';
+} \ No newline at end of file