Website Summary Files Commits Branches @commit @diff @stats
path: root / Polymorphism / Figures / Farm(cloneFunction) / Animal.hpp
diff options
context:
space:
mode:
Commit769773c5fd9318348eb31d17b219f00fca265eb3 (patch)
Author
 Angeld55 <achi_d@abv.bg>
2019-09-20 14:29:01 +0300
Committer
 GitHub <noreply@github.com>
2019-09-20 14:29:01 +0300
Filesa4f47423bc66af48902a8db993d74b1d46a46fc2 /Polymorphism/Figures/Farm(cloneFunction)/Animal.hpp
Object-oriented_programming_FMI-769773c5fd9318348eb31d17b219f00fca265eb3.tar
Object-oriented_programming_FMI-769773c5fd9318348eb31d17b219f00fca265eb3.tar.gz
Object-oriented_programming_FMI-769773c5fd9318348eb31d17b219f00fca265eb3.zip
Parent7bc7153a441129c1a0665aa3d0d22c2d63c61270 (diff)
Add files via upload
1 files changed, 17 insertions, 1 deletions
-rw-r--r--Polymorphism/Figures/Farm(cloneFunction)/Animal.hpp18
diff --git a/Polymorphism/Figures/Farm(cloneFunction)/Animal.hpp b/Polymorphism/Figures/Farm(cloneFunction)/Animal.hpp
index b478595..dc9cedd 100644
--- a/Polymorphism/Figures/Farm(cloneFunction)/Animal.hpp
+++ b/Polymorphism/Figures/Farm(cloneFunction)/Animal.hpp
@@ -1 +1,17 @@
-s
+#include "Animal.hpp"
+
+class Animal
+{
+
+ String name;
+public:
+ Animal(String name)
+ {
+ this->name = name;
+ }
+ virtual void Roar() = 0;
+ virtual Animal* clone() = 0; // Всеки наследник се копира по различен начин.
+ // За това правим тази виртуална функция и всеки наследник да окаже как се копират данните му.
+ virtual ~Animal() {};
+
+}; \ No newline at end of file