From 769773c5fd9318348eb31d17b219f00fca265eb3 Mon Sep 17 00:00:00 2001 From: Angeld55 Date: Fri, 20 Sep 2019 14:29:01 +0300 Subject: Add files via upload --- Polymorphism/Figures/Farm(cloneFunction)/Cat.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Polymorphism/Figures/Farm(cloneFunction)/Cat.hpp (limited to 'Polymorphism/Figures/Farm(cloneFunction)/Cat.hpp') diff --git a/Polymorphism/Figures/Farm(cloneFunction)/Cat.hpp b/Polymorphism/Figures/Farm(cloneFunction)/Cat.hpp new file mode 100644 index 0000000..da76fe3 --- /dev/null +++ b/Polymorphism/Figures/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; + } +}; \ No newline at end of file -- cgit v1.3.1-23-gd82d