Website Summary Files Commits Branches @commit @diff @stats
path: root / Polymorphism / Farm(cloneFunction)
diff options
context:
space:
mode:
Commitb10017c7a5a504d51f044cdd2ee833660d89ee9f (patch)
Author
 Angeld55 <achi_d@abv.bg>
2019-09-20 14:30:07 +0300
Committer
 GitHub <noreply@github.com>
2019-09-20 14:30:07 +0300
Files3490023f5fc33144e9d10bef3bc0861371a789d9 /Polymorphism/Farm(cloneFunction)
Object-oriented_programming_FMI-b10017c7a5a504d51f044cdd2ee833660d89ee9f.tar
Object-oriented_programming_FMI-b10017c7a5a504d51f044cdd2ee833660d89ee9f.tar.gz
Object-oriented_programming_FMI-b10017c7a5a504d51f044cdd2ee833660d89ee9f.zip
Parent384fbedc32caf22c3b8be002aaabf9ce4d78720c (diff)
Rename Polymorphism/Figures/Farm(cloneFunction)/Cat.hpp to Polymorphism/Farm(cloneFunction)/Cat.hpp
1 files changed, 17 insertions, 0 deletions
-rw-r--r--Polymorphism/Farm(cloneFunction)/Cat.hpp17
diff --git a/Polymorphism/Farm(cloneFunction)/Cat.hpp b/Polymorphism/Farm(cloneFunction)/Cat.hpp
new file mode 100644
index 0000000..3b11228
--- /dev/null
+++ b/Polymorphism/Farm(cloneFunction)/Cat.hpp
@@ -0,0 +1,17 @@
+#include "Animal.hpp"
+
+class Cat : public Animal
+{
+public:
+ Cat(String name) :Animal(name)
+ {}
+ Animal* clone()
+ {
+ Animal* copy = new Cat(*this);
+ return copy;
+ }
+ void Roar()
+ {
+ std::cout << "meow meow" << std::endl;
+ }
+};