Sfoglia il codice sorgente

added module04 . ex03 to finish

bastien 1 mese fa
parent
commit
d354133465
43 ha cambiato i file con 2366 aggiunte e 0 eliminazioni
  1. 50 0
      Module_04/ex00/Makefile
  2. 41 0
      Module_04/ex00/includes/Animal.hpp
  3. 41 0
      Module_04/ex00/includes/AnimalWrong.hpp
  4. 39 0
      Module_04/ex00/includes/Cat.hpp
  5. 39 0
      Module_04/ex00/includes/CatWrong.hpp
  6. 39 0
      Module_04/ex00/includes/Dog.hpp
  7. 83 0
      Module_04/ex00/srcs/Animal.cpp
  8. 83 0
      Module_04/ex00/srcs/AnimalWrong.cpp
  9. 75 0
      Module_04/ex00/srcs/Cat.cpp
  10. 75 0
      Module_04/ex00/srcs/CatWrong.cpp
  11. 75 0
      Module_04/ex00/srcs/Dog.cpp
  12. 32 0
      Module_04/ex00/srcs/main.cpp
  13. 50 0
      Module_04/ex01/Makefile
  14. 41 0
      Module_04/ex01/includes/Animal.hpp
  15. 37 0
      Module_04/ex01/includes/Brain.hpp
  16. 40 0
      Module_04/ex01/includes/Cat.hpp
  17. 40 0
      Module_04/ex01/includes/Dog.hpp
  18. 83 0
      Module_04/ex01/srcs/Animal.cpp
  19. 71 0
      Module_04/ex01/srcs/Brain.cpp
  20. 77 0
      Module_04/ex01/srcs/Cat.cpp
  21. 78 0
      Module_04/ex01/srcs/Dog.cpp
  22. 39 0
      Module_04/ex01/srcs/main.cpp
  23. 50 0
      Module_04/ex02/Makefile
  24. 40 0
      Module_04/ex02/includes/AAnimal.hpp
  25. 37 0
      Module_04/ex02/includes/Brain.hpp
  26. 40 0
      Module_04/ex02/includes/Cat.hpp
  27. 40 0
      Module_04/ex02/includes/Dog.hpp
  28. 75 0
      Module_04/ex02/srcs/AAnimal.cpp
  29. 71 0
      Module_04/ex02/srcs/Brain.cpp
  30. 77 0
      Module_04/ex02/srcs/Cat.cpp
  31. 78 0
      Module_04/ex02/srcs/Dog.cpp
  32. 39 0
      Module_04/ex02/srcs/main.cpp
  33. 50 0
      Module_04/ex03/Makefile
  34. 41 0
      Module_04/ex03/includes/AMateria.hpp
  35. 46 0
      Module_04/ex03/includes/Character.hpp
  36. 39 0
      Module_04/ex03/includes/Cure.hpp
  37. 40 0
      Module_04/ex03/includes/ICharacter.hpp
  38. 39 0
      Module_04/ex03/includes/Ice.hpp
  39. 67 0
      Module_04/ex03/srcs/AMateria.cpp
  40. 97 0
      Module_04/ex03/srcs/Character.cpp
  41. 70 0
      Module_04/ex03/srcs/Cure.cpp
  42. 70 0
      Module_04/ex03/srcs/Ice.cpp
  43. 32 0
      Module_04/ex03/srcs/main.cpp

+ 50 - 0
Module_04/ex00/Makefile

@@ -0,0 +1,50 @@
+# **************************************************************************** #
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#    Updated: 2025/12/18 17:07:12 by bchanot          ###   ########.fr        #
+#                                                                              #
+# **************************************************************************** #
+
+NAME = a.out
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main Animal Dog Cat AnimalWrong CatWrong
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

+ 41 - 0
Module_04/ex00/includes/Animal.hpp

@@ -0,0 +1,41 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Animal.hpp                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:26:41 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 16:41:37 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef ANIMAL_HPP
+# define ANIMAL_HPP
+
+# include <iostream>
+# include <string>
+
+class Animal
+{
+
+	public:
+
+		Animal();
+		Animal( Animal const & src );
+		Animal( std::string const & type );
+		~Animal();
+
+		Animal &		operator=( Animal const & rhs );
+
+		virtual void			makeSound(void) const;
+		std::string				getType(void) const;
+
+	protected:
+		std::string			type;
+
+};
+
+std::ostream &			operator<<( std::ostream & o, Animal const & i );
+
+#endif /* ********************************************************** ANIMAL_H */

+ 41 - 0
Module_04/ex00/includes/AnimalWrong.hpp

@@ -0,0 +1,41 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   AnimalWrong.hpp                                    :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:26:41 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 17:01:40 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef ANIMALWRONG_HPP
+# define ANIMALWRONG_HPP
+
+# include <iostream>
+# include <string>
+
+class AnimalWrong
+{
+
+	public:
+
+		AnimalWrong();
+		AnimalWrong( AnimalWrong const & src );
+		AnimalWrong( std::string const & type );
+		~AnimalWrong();
+
+		AnimalWrong &		operator=( AnimalWrong const & rhs );
+
+		void			makeSound(void) const;
+		std::string				getType(void) const;
+
+	protected:
+		std::string			type;
+
+};
+
+std::ostream &			operator<<( std::ostream & o, AnimalWrong const & i );
+
+#endif /* ********************************************************** ANIMAL_H */

+ 39 - 0
Module_04/ex00/includes/Cat.hpp

@@ -0,0 +1,39 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Cat.hpp                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:28:27 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 17:06:55 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef CATWRONG_HPP
+# define CATWRONG_HPP
+
+# include <iostream>
+# include <string>
+#include "Animal.hpp"
+
+class Cat : public Animal
+{
+
+	public:
+
+		Cat();
+		Cat( Cat const & src );
+		~Cat();
+
+		Cat &		operator=( Cat const & rhs );
+
+		virtual void			makeSound(void) const;
+
+	private:
+
+};
+
+std::ostream &			operator<<( std::ostream & o, Cat const & i );
+
+#endif /* ************************************************************* CAT_H */

+ 39 - 0
Module_04/ex00/includes/CatWrong.hpp

@@ -0,0 +1,39 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   CatWrong.hpp                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:28:27 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 17:03:19 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef CAT_HPP
+# define CAT_HPP
+
+# include <iostream>
+# include <string>
+#include "AnimalWrong.hpp"
+
+class CatWrong : public AnimalWrong
+{
+
+	public:
+
+		CatWrong();
+		CatWrong( CatWrong const & src );
+		~CatWrong();
+
+		CatWrong &		operator=( CatWrong const & rhs );
+
+		void			makeSound(void) const;
+
+	private:
+
+};
+
+std::ostream &			operator<<( std::ostream & o, CatWrong const & i );
+
+#endif /* ************************************************************* CAT_H */

+ 39 - 0
Module_04/ex00/includes/Dog.hpp

@@ -0,0 +1,39 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Dog.hpp                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:27:49 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 16:35:30 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef DOG_HPP
+# define DOG_HPP
+
+# include <iostream>
+# include <string>
+#include "Animal.hpp"
+
+class Dog : public Animal
+{
+
+	public:
+
+		Dog();
+		Dog( Dog const & src );
+		~Dog();
+
+		Dog &		operator=( Dog const & rhs );
+
+		virtual void			makeSound(void) const;
+
+	private:
+
+};
+
+std::ostream &			operator<<( std::ostream & o, Dog const & i );
+
+#endif /* ************************************************************* DOG_H */

+ 83 - 0
Module_04/ex00/srcs/Animal.cpp

@@ -0,0 +1,83 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Animal.cpp                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:26:41 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 17:02:51 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Animal.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+Animal::Animal() : type("Default")
+{
+	std::cout << "An animal type Default is born." << std::endl;
+}
+
+Animal::Animal( std::string const & type ) : type(type)
+{
+	std::cout << "An animal type " << this->type << " Is born." << std::endl;
+}
+
+Animal::Animal( const Animal & src ) : type(src.type)
+{
+	std::cout << "An animal type " << this->type << " Is born." << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+Animal::~Animal()
+{
+	std::cout << "An animal type " << this->type << " has died..." << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+Animal &				Animal::operator=( Animal const & rhs )
+{
+	if ( this != &rhs )
+	{
+		this->type = rhs.type;
+	}
+	return *this;
+}
+
+std::ostream &			operator<<( std::ostream & o, Animal const & i )
+{
+	(void)i;
+	//o << "Value = " << i.getValue();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+void				Animal::makeSound(void) const {
+	std::cout << "*An undefined animal noise*" << std::endl;
+}
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+std::string			Animal::getType(void) const {
+	return this->type;
+}
+
+
+/* ************************************************************************** */

+ 83 - 0
Module_04/ex00/srcs/AnimalWrong.cpp

@@ -0,0 +1,83 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   AnimalWrong.cpp                                    :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:26:41 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 17:03:09 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "AnimalWrong.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+AnimalWrong::AnimalWrong() : type("Default")
+{
+	std::cout << "An animal type Default is born." << std::endl;
+}
+
+AnimalWrong::AnimalWrong( std::string const & type ) : type(type)
+{
+	std::cout << "An animal type " << this->type << " Is born." << std::endl;
+}
+
+AnimalWrong::AnimalWrong( const AnimalWrong & src ) : type(src.type)
+{
+	std::cout << "An animal type " << this->type << " Is born." << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+AnimalWrong::~AnimalWrong()
+{
+	std::cout << "An animal type " << this->type << " has died..." << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+AnimalWrong &				AnimalWrong::operator=( AnimalWrong const & rhs )
+{
+	if ( this != &rhs )
+	{
+		this->type = rhs.type;
+	}
+	return *this;
+}
+
+std::ostream &			operator<<( std::ostream & o, AnimalWrong const & i )
+{
+	(void)i;
+	//o << "Value = " << i.getValue();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+void				AnimalWrong::makeSound(void) const {
+	std::cout << "*An undefined animal noise*" << std::endl;
+}
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+std::string			AnimalWrong::getType(void) const {
+	return this->type;
+}
+
+
+/* ************************************************************************** */

+ 75 - 0
Module_04/ex00/srcs/Cat.cpp

@@ -0,0 +1,75 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Cat.cpp                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:28:27 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 16:48:38 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Cat.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+Cat::Cat() : Animal("Cat")
+{
+	std::cout << "A Cat is born !" << std::endl;
+}
+
+Cat::Cat( const Cat & src ) : Animal(src)
+{
+	std::cout << "A " << this->type << " is born !" << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+Cat::~Cat()
+{
+	std::cout << "A " << this->type << "has died ..." << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+Cat &				Cat::operator=( Cat const & rhs )
+{
+	(void)rhs;
+	//if ( this != &rhs )
+	//{
+		//this->_value = rhs.getValue();
+	//}
+	return *this;
+}
+
+std::ostream &			operator<<( std::ostream & o, Cat const & i )
+{
+	(void)i;
+	//o << "Value = " << i.getValue();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+void				Cat::makeSound(void) const {
+	std::cout << "*Miaouuu*" << std::endl;
+}
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+
+/* ************************************************************************** */

+ 75 - 0
Module_04/ex00/srcs/CatWrong.cpp

@@ -0,0 +1,75 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   CatWrong.cpp                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:28:27 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 17:03:55 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "CatWrong.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+CatWrong::CatWrong() : AnimalWrong("CatWrong")
+{
+	std::cout << "A CatWrong is born !" << std::endl;
+}
+
+CatWrong::CatWrong( const CatWrong & src ) : AnimalWrong(src)
+{
+	std::cout << "A " << this->type << " is born !" << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+CatWrong::~CatWrong()
+{
+	std::cout << "A " << this->type << "has died ..." << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+CatWrong &				CatWrong::operator=( CatWrong const & rhs )
+{
+	(void)rhs;
+	//if ( this != &rhs )
+	//{
+		//this->_value = rhs.getValue();
+	//}
+	return *this;
+}
+
+std::ostream &			operator<<( std::ostream & o, CatWrong const & i )
+{
+	(void)i;
+	//o << "Value = " << i.getValue();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+void				CatWrong::makeSound(void) const {
+	std::cout << "*Miaouuu*" << std::endl;
+}
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+
+/* ************************************************************************** */

+ 75 - 0
Module_04/ex00/srcs/Dog.cpp

@@ -0,0 +1,75 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Dog.cpp                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:27:49 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 16:49:00 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Dog.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+Dog::Dog() : Animal("Dog")
+{
+	std::cout << "A Dog is born !" << std::endl;
+}
+
+Dog::Dog( const Dog & src ) : Animal(src)
+{
+	std::cout << "A " << this->type << " is born !" << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+Dog::~Dog()
+{
+	std::cout << "A " << this->type << "has died ..." << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+Dog &				Dog::operator=( Dog const & rhs )
+{
+	(void)rhs;
+	//if ( this != &rhs )
+	//{
+		//this->_value = rhs.getValue();
+	//}
+	return *this;
+}
+
+std::ostream &			operator<<( std::ostream & o, Dog const & i )
+{
+	(void)i;
+	//o << "Value = " << i.getValue();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+void				Dog::makeSound(void) const {
+	std::cout << "*Waf Waf*" << std::endl;
+}
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+
+/* ************************************************************************** */

+ 32 - 0
Module_04/ex00/srcs/main.cpp

@@ -0,0 +1,32 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   main.cpp                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/17 15:10:40 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 17:05:50 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Animal.hpp"
+#include "Dog.hpp"
+#include "Cat.hpp"
+#include "CatWrong.hpp"
+#include "AnimalWrong.hpp"
+
+#include <iostream>
+#include <limits>
+
+int main( void ) {
+	const AnimalWrong* meta = new AnimalWrong();
+const Animal* j = new Dog();
+const AnimalWrong* i = new CatWrong();
+std::cout << j->getType() << " " << std::endl;
+std::cout << i->getType() << " " << std::endl;
+i->makeSound(); //will output the cat sound!
+j->makeSound();
+meta->makeSound();
+return 0;
+}

+ 50 - 0
Module_04/ex01/Makefile

@@ -0,0 +1,50 @@
+# **************************************************************************** #
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#    Updated: 2025/12/18 18:28:43 by bchanot          ###   ########.fr        #
+#                                                                              #
+# **************************************************************************** #
+
+NAME = a.out
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main Animal Dog Cat Brain
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

+ 41 - 0
Module_04/ex01/includes/Animal.hpp

@@ -0,0 +1,41 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Animal.hpp                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:26:41 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 18:15:39 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef ANIMAL_HPP
+# define ANIMAL_HPP
+
+# include <iostream>
+# include <string>
+
+class Animal
+{
+
+	public:
+
+		Animal();
+		Animal( Animal const & src );
+		Animal( std::string const & type );
+		virtual ~Animal();
+
+		Animal &		operator=( Animal const & rhs );
+
+		virtual void			makeSound(void) const;
+		std::string				getType(void) const;
+
+	protected:
+		std::string			type;
+
+};
+
+std::ostream &			operator<<( std::ostream & o, Animal const & i );
+
+#endif /* ********************************************************** ANIMAL_H */

+ 37 - 0
Module_04/ex01/includes/Brain.hpp

@@ -0,0 +1,37 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Brain.hpp                                          :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 17:12:31 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 17:27:51 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef BRAIN_HPP
+# define BRAIN_HPP
+
+# include <iostream>
+# include <string>
+
+class Brain
+{
+
+	public:
+
+		Brain();
+		Brain( Brain const & src );
+		~Brain();
+
+		Brain &		operator=( Brain const & rhs );
+
+	protected:
+		std::string			_ideas[100];
+
+};
+
+std::ostream &			operator<<( std::ostream & o, Brain const & i );
+
+#endif /* *********************************************************** BRAIN_H */

+ 40 - 0
Module_04/ex01/includes/Cat.hpp

@@ -0,0 +1,40 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Cat.hpp                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:28:27 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 17:31:14 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef CAT_HPP
+# define CAT_HPP
+
+# include <iostream>
+# include <string>
+#include "Animal.hpp"
+#include "Brain.hpp"
+
+class Cat : public Animal
+{
+
+	public:
+
+		Cat();
+		Cat( Cat const & src );
+		~Cat();
+
+		Cat &			operator=( Cat const & rhs );
+
+		virtual void	makeSound(void) const;
+
+	private:
+		Brain 			* _brain;
+};
+
+std::ostream &			operator<<( std::ostream & o, Cat const & i );
+
+#endif /* ************************************************************* CAT_H */

+ 40 - 0
Module_04/ex01/includes/Dog.hpp

@@ -0,0 +1,40 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Dog.hpp                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:27:49 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 17:16:18 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef DOG_HPP
+# define DOG_HPP
+
+# include <iostream>
+# include <string>
+#include "Animal.hpp"
+#include "Brain.hpp"
+
+class Dog : public Animal
+{
+
+	public:
+
+		Dog();
+		Dog( Dog const & src );
+		~Dog();
+
+		Dog &			operator=( Dog const & rhs );
+
+		virtual void	makeSound(void) const;
+
+	private:
+		Brain			*_brain;
+};
+
+std::ostream &			operator<<( std::ostream & o, Dog const & i );
+
+#endif /* ************************************************************* DOG_H */

+ 83 - 0
Module_04/ex01/srcs/Animal.cpp

@@ -0,0 +1,83 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Animal.cpp                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:26:41 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 17:02:51 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Animal.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+Animal::Animal() : type("Default")
+{
+	std::cout << "An animal type Default is born." << std::endl;
+}
+
+Animal::Animal( std::string const & type ) : type(type)
+{
+	std::cout << "An animal type " << this->type << " Is born." << std::endl;
+}
+
+Animal::Animal( const Animal & src ) : type(src.type)
+{
+	std::cout << "An animal type " << this->type << " Is born." << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+Animal::~Animal()
+{
+	std::cout << "An animal type " << this->type << " has died..." << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+Animal &				Animal::operator=( Animal const & rhs )
+{
+	if ( this != &rhs )
+	{
+		this->type = rhs.type;
+	}
+	return *this;
+}
+
+std::ostream &			operator<<( std::ostream & o, Animal const & i )
+{
+	(void)i;
+	//o << "Value = " << i.getValue();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+void				Animal::makeSound(void) const {
+	std::cout << "*An undefined animal noise*" << std::endl;
+}
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+std::string			Animal::getType(void) const {
+	return this->type;
+}
+
+
+/* ************************************************************************** */

+ 71 - 0
Module_04/ex01/srcs/Brain.cpp

@@ -0,0 +1,71 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Brain.cpp                                          :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 17:12:31 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 18:25:05 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Brain.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+Brain::Brain()
+{
+	std::cout << "Creating a brain" << std::endl;
+}
+
+Brain::Brain( const Brain & src ) : _ideas(src._ideas)
+{
+	std::cout << "Copying a brain" << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+Brain::~Brain()
+{
+	std::cout << "Deleting a brain.." << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+Brain &				Brain::operator=( Brain const & rhs )
+{
+	if ( this != &rhs )
+	{
+		*this->_ideas = *rhs._ideas;
+	}
+	return *this;
+}
+
+std::ostream &			operator<<( std::ostream & o, Brain const & i )
+{
+	(void)i;
+	//o << "Value = " << i.getValue();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+
+/* ************************************************************************** */

+ 77 - 0
Module_04/ex01/srcs/Cat.cpp

@@ -0,0 +1,77 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Cat.cpp                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:28:27 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 18:21:47 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Cat.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+Cat::Cat() : Animal("Cat"), _brain(new Brain())
+{
+	std::cout << "A Cat is born !" << std::endl;
+}
+
+Cat::Cat( const Cat & src ) : Animal(src), _brain(new Brain(*src._brain))
+{
+	std::cout << "A " << this->type << " is born !" << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+Cat::~Cat()
+{
+	delete this->_brain;
+	std::cout << "A " << this->type << " has died ..." << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+Cat &				Cat::operator=( Cat const & rhs )
+{
+	if ( this != &rhs )
+	{
+		delete this->_brain;
+		Animal::operator=(rhs);
+		this->_brain = new Brain(*rhs._brain);
+	}
+	return *this;
+}
+
+std::ostream &			operator<<( std::ostream & o, Cat const & i )
+{
+	(void)i;
+	//o << "Value = " << i.getValue();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+void				Cat::makeSound(void) const {
+	std::cout << "*Miaouuu*" << std::endl;
+}
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+
+/* ************************************************************************** */

+ 78 - 0
Module_04/ex01/srcs/Dog.cpp

@@ -0,0 +1,78 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Dog.cpp                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:27:49 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 18:34:32 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Dog.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+Dog::Dog() : Animal("Dog"), _brain(new Brain())
+{
+	std::cout << "A Dog is born !" << std::endl;
+}
+
+Dog::Dog( const Dog & src ) : Animal(src), _brain(new Brain(*src._brain))
+{
+	std::cout << "A " << this->type << " is born !" << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+Dog::~Dog()
+{
+	delete this->_brain;
+	std::cout << "A " << this->type << " has died ..." << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+Dog &				Dog::operator=( Dog const & rhs )
+{
+	(void)rhs;
+	if ( this != &rhs )
+	{
+		delete this->_brain;
+		Animal::operator=(rhs);
+		this->_brain = new Brain(*rhs._brain);
+	}
+	return *this;
+}
+
+std::ostream &			operator<<( std::ostream & o, Dog const & i )
+{
+	(void)i;
+	//o << "Value = " << i.getValue();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+void				Dog::makeSound(void) const {
+	std::cout << "*Waf Waf*" << std::endl;
+}
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+
+/* ************************************************************************** */

+ 39 - 0
Module_04/ex01/srcs/main.cpp

@@ -0,0 +1,39 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   main.cpp                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/17 15:10:40 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 18:34:21 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Animal.hpp"
+#include "Dog.hpp"
+#include "Cat.hpp"
+
+#include <iostream>
+#include <limits>
+
+int main( void ) {
+	Animal* animals[10];
+
+	for (int i = 0; i < 5; i++)
+		animals[i] = new Dog();
+
+	for (int i = 5; i < 10; i++)
+		animals[i] = new Cat();
+
+	for (int j = 0; j < 10; j++) 
+		delete animals[j];
+
+
+	const Animal* a = new Dog();
+	const Animal* b = new Cat();
+	delete a;//should not create a leak
+	delete b;
+
+	return 0;
+}

+ 50 - 0
Module_04/ex02/Makefile

@@ -0,0 +1,50 @@
+# **************************************************************************** #
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#    Updated: 2025/12/18 18:47:10 by bchanot          ###   ########.fr        #
+#                                                                              #
+# **************************************************************************** #
+
+NAME = a.out
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main AAnimal Dog Cat Brain
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

+ 40 - 0
Module_04/ex02/includes/AAnimal.hpp

@@ -0,0 +1,40 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Animal.hpp                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:26:41 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 18:45:42 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef AANIMAL_HPP
+# define AANIMAL_HPP
+
+# include <iostream>
+# include <string>
+
+class AAnimal
+{
+
+	public:
+
+		AAnimal();
+		AAnimal( AAnimal const & src );
+		AAnimal( std::string const & type );
+		virtual ~AAnimal();
+
+		AAnimal &			operator=( AAnimal const & rhs );
+
+		virtual void		makeSound(void) const = 0;
+
+	protected:
+		std::string			type;
+
+};
+
+std::ostream &			operator<<( std::ostream & o, AAnimal const & i );
+
+#endif /* ********************************************************** ANIMAL_H */

+ 37 - 0
Module_04/ex02/includes/Brain.hpp

@@ -0,0 +1,37 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Brain.hpp                                          :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 17:12:31 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 17:27:51 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef BRAIN_HPP
+# define BRAIN_HPP
+
+# include <iostream>
+# include <string>
+
+class Brain
+{
+
+	public:
+
+		Brain();
+		Brain( Brain const & src );
+		~Brain();
+
+		Brain &		operator=( Brain const & rhs );
+
+	protected:
+		std::string			_ideas[100];
+
+};
+
+std::ostream &			operator<<( std::ostream & o, Brain const & i );
+
+#endif /* *********************************************************** BRAIN_H */

+ 40 - 0
Module_04/ex02/includes/Cat.hpp

@@ -0,0 +1,40 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Cat.hpp                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:28:27 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 18:46:00 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef CAT_HPP
+# define CAT_HPP
+
+# include <iostream>
+# include <string>
+#include "AAnimal.hpp"
+#include "Brain.hpp"
+
+class Cat : public AAnimal
+{
+
+	public:
+
+		Cat();
+		Cat( Cat const & src );
+		~Cat();
+
+		Cat &			operator=( Cat const & rhs );
+
+		virtual void	makeSound(void) const;
+
+	private:
+		Brain 			* _brain;
+};
+
+std::ostream &			operator<<( std::ostream & o, Cat const & i );
+
+#endif /* ************************************************************* CAT_H */

+ 40 - 0
Module_04/ex02/includes/Dog.hpp

@@ -0,0 +1,40 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Dog.hpp                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:27:49 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 18:48:08 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef DOG_HPP
+# define DOG_HPP
+
+# include <iostream>
+# include <string>
+#include "AAnimal.hpp"
+#include "Brain.hpp"
+
+class Dog : public AAnimal
+{
+
+	public:
+
+		Dog();
+		Dog( Dog const & src );
+		~Dog();
+
+		Dog &			operator=( Dog const & rhs );
+
+		virtual void	makeSound(void) const;
+
+	private:
+		Brain			*_brain;
+};
+
+std::ostream &			operator<<( std::ostream & o, Dog const & i );
+
+#endif /* ************************************************************* DOG_H */

+ 75 - 0
Module_04/ex02/srcs/AAnimal.cpp

@@ -0,0 +1,75 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   AAnimal.cpp                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:26:41 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 18:47:20 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "AAnimal.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+AAnimal::AAnimal() : type("Default")
+{
+	std::cout << "An animal type Default is born." << std::endl;
+}
+
+AAnimal::AAnimal( std::string const & type ) : type(type)
+{
+	std::cout << "An animal type " << this->type << " Is born." << std::endl;
+}
+
+AAnimal::AAnimal( const AAnimal & src ) : type(src.type)
+{
+	std::cout << "An animal type " << this->type << " Is born." << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+AAnimal::~AAnimal()
+{
+	std::cout << "An animal type " << this->type << " has died..." << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+AAnimal &				AAnimal::operator=( AAnimal const & rhs )
+{
+	if ( this != &rhs )
+	{
+		this->type = rhs.type;
+	}
+	return *this;
+}
+
+std::ostream &			operator<<( std::ostream & o, AAnimal const & i )
+{
+	(void)i;
+	//o << "Value = " << i.getValue();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+
+/* ************************************************************************** */

+ 71 - 0
Module_04/ex02/srcs/Brain.cpp

@@ -0,0 +1,71 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Brain.cpp                                          :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 17:12:31 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 18:25:05 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Brain.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+Brain::Brain()
+{
+	std::cout << "Creating a brain" << std::endl;
+}
+
+Brain::Brain( const Brain & src ) : _ideas(src._ideas)
+{
+	std::cout << "Copying a brain" << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+Brain::~Brain()
+{
+	std::cout << "Deleting a brain.." << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+Brain &				Brain::operator=( Brain const & rhs )
+{
+	if ( this != &rhs )
+	{
+		*this->_ideas = *rhs._ideas;
+	}
+	return *this;
+}
+
+std::ostream &			operator<<( std::ostream & o, Brain const & i )
+{
+	(void)i;
+	//o << "Value = " << i.getValue();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+
+/* ************************************************************************** */

+ 77 - 0
Module_04/ex02/srcs/Cat.cpp

@@ -0,0 +1,77 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Cat.cpp                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:28:27 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 18:48:50 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Cat.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+Cat::Cat() : AAnimal("Cat"), _brain(new Brain())
+{
+	std::cout << "A Cat is born !" << std::endl;
+}
+
+Cat::Cat( const Cat & src ) : AAnimal(src), _brain(new Brain(*src._brain))
+{
+	std::cout << "A " << this->type << " is born !" << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+Cat::~Cat()
+{
+	delete this->_brain;
+	std::cout << "A " << this->type << " has died ..." << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+Cat &				Cat::operator=( Cat const & rhs )
+{
+	if ( this != &rhs )
+	{
+		delete this->_brain;
+		AAnimal::operator=(rhs);
+		this->_brain = new Brain(*rhs._brain);
+	}
+	return *this;
+}
+
+std::ostream &			operator<<( std::ostream & o, Cat const & i )
+{
+	(void)i;
+	//o << "Value = " << i.getValue();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+void				Cat::makeSound(void) const {
+	std::cout << "*Miaouuu*" << std::endl;
+}
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+
+/* ************************************************************************** */

+ 78 - 0
Module_04/ex02/srcs/Dog.cpp

@@ -0,0 +1,78 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Dog.cpp                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 16:27:49 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 18:51:01 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Dog.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+Dog::Dog() : AAnimal("Dog"), _brain(new Brain())
+{
+	std::cout << "A Dog is born !" << std::endl;
+}
+
+Dog::Dog( const Dog & src ) : AAnimal(src), _brain(new Brain(*src._brain))
+{
+	std::cout << "A " << this->type << " is born !" << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+Dog::~Dog()
+{
+	delete this->_brain;
+	std::cout << "A " << this->type << " has died ..." << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+Dog &				Dog::operator=( Dog const & rhs )
+{
+	(void)rhs;
+	if ( this != &rhs )
+	{
+		delete this->_brain;
+		AAnimal::operator=(rhs);
+		this->_brain = new Brain(*rhs._brain);
+	}
+	return *this;
+}
+
+std::ostream &			operator<<( std::ostream & o, Dog const & i )
+{
+	(void)i;
+	//o << "Value = " << i.getValue();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+void				Dog::makeSound(void) const {
+	std::cout << "*Waf Waf*" << std::endl;
+}
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+
+/* ************************************************************************** */

+ 39 - 0
Module_04/ex02/srcs/main.cpp

@@ -0,0 +1,39 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   main.cpp                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/17 15:10:40 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 18:54:02 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "AAnimal.hpp"
+#include "Dog.hpp"
+#include "Cat.hpp"
+
+#include <iostream>
+#include <limits>
+
+int main( void ) {
+	AAnimal* animals[10];
+
+	for (int i = 0; i < 5; i++)
+		animals[i] = new Dog();
+
+	for (int i = 5; i < 10; i++)
+		animals[i] = new Cat();
+
+	for (int j = 0; j < 10; j++) 
+		delete animals[j];
+
+
+	const AAnimal* a = new Dog();
+	const AAnimal* b = new Cat();
+	delete a;//should not create a leak
+	delete b;
+
+	return 0;
+}

+ 50 - 0
Module_04/ex03/Makefile

@@ -0,0 +1,50 @@
+# **************************************************************************** #
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#    Updated: 2025/12/18 17:07:12 by bchanot          ###   ########.fr        #
+#                                                                              #
+# **************************************************************************** #
+
+NAME = a.out
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main Animal Dog Cat AnimalWrong CatWrong
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

+ 41 - 0
Module_04/ex03/includes/AMateria.hpp

@@ -0,0 +1,41 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   AMateria.hpp                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 19:23:39 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/19 15:29:08 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef AMATERIA_HPP
+# define AMATERIA_HPP
+
+# include <iostream>
+# include <string>
+
+#include "ICharacter.hpp"
+
+class AMateria
+{
+
+	public:
+
+		AMateria();
+		AMateria(std::string const & type);
+		AMateria( AMateria const & src );
+		~AMateria();
+
+
+		std::string const & 	getType() const;
+		virtual AMateria* 		clone() const = 0;
+		virtual void 			use(ICharacter& target);
+
+	protected:
+		std::string const		&_type;
+
+};
+
+#endif /* ******************************************************** AMATERIA_H */

+ 46 - 0
Module_04/ex03/includes/Character.hpp

@@ -0,0 +1,46 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Character.hpp                                      :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/19 16:40:56 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/19 16:48:33 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef CHARACTER_HPP
+# define CHARACTER_HPP
+
+# include <iostream>
+# include <string>
+
+#include "ICharacter.hpp"
+
+class Character : public ICharacter
+{
+
+	public:
+
+		Character();
+		Character( Character const & src );
+		Character( std::string const &name );
+		~Character();
+
+		Character &		operator=( Character const & rhs );
+
+		virtual std::string const & getName() const;
+		virtual void equip(AMateria* m);
+		virtual void unequip(int idx);
+		virtual void use(int idx, ICharacter& target);
+
+	private:
+		std::string	const &	_name;
+		AMateria			*_items[4];
+
+};
+
+std::ostream &			operator<<( std::ostream & o, Character const & i );
+
+#endif /* ******************************************************* CHARACTER_H */

+ 39 - 0
Module_04/ex03/includes/Cure.hpp

@@ -0,0 +1,39 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Cure.hpp                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/19 15:29:40 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/19 15:45:48 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef CURE_HPP
+# define CURE_HPP
+
+# include <iostream>
+# include <string>
+
+#include "AMateria.hpp"
+
+class Cure : public AMateria 
+{
+
+	public:
+
+		Cure();
+		Cure( Cure const & src );
+		~Cure();
+
+		Cure &		operator=( Cure const & rhs ) = delete;
+
+		virtual AMateria* 		clone() const;
+		virtual void 			use(ICharacter& target);
+
+};
+
+std::ostream &			operator<<( std::ostream & o, Cure const & i );
+
+#endif /* ************************************************************* CURE_H */

+ 40 - 0
Module_04/ex03/includes/ICharacter.hpp

@@ -0,0 +1,40 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ICharacter.hpp                                     :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 19:26:25 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/19 16:48:15 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef ICHARACTER_HPP
+# define ICHARACTER_HPP
+
+# include <iostream>
+# include <string>
+
+#include "AMateria.hpp"
+
+class ICharacter
+{
+
+	public:
+
+		virtual ~ICharacter() {}
+
+
+		virtual std::string const & 	getName() const = 0;
+		virtual void 					equip(AMateria* m) = 0;
+		virtual void 					unequip(int idx) = 0;
+		virtual void 					use(int idx, ICharacter& target) = 0;
+
+		ICharacter &		operator=( ICharacter const & rhs ) = delete;
+
+};
+
+std::ostream &			operator<<( std::ostream & o, ICharacter const & i );
+
+#endif /* ****************************************************** ICHARACTER_H */

+ 39 - 0
Module_04/ex03/includes/Ice.hpp

@@ -0,0 +1,39 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Ice.hpp                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/19 15:29:40 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/19 15:45:48 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef ICE_HPP
+# define ICE_HPP
+
+# include <iostream>
+# include <string>
+
+#include "AMateria.hpp"
+
+class Ice : public AMateria 
+{
+
+	public:
+
+		Ice();
+		Ice( Ice const & src );
+		~Ice();
+
+		Ice &		operator=( Ice const & rhs ) = delete;
+
+		virtual AMateria* 		clone() const;
+		virtual void 			use(ICharacter& target);
+
+};
+
+std::ostream &			operator<<( std::ostream & o, Ice const & i );
+
+#endif /* ************************************************************* ICE_H */

+ 67 - 0
Module_04/ex03/srcs/AMateria.cpp

@@ -0,0 +1,67 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   AMateria.cpp                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/18 19:23:39 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/19 15:29:23 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "AMateria.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+AMateria::AMateria() : _type("Punch")
+{ 
+	std::cout << this->_type << " AMateria constructed" << std::endl;
+}
+
+AMateria::AMateria(std::string const & type) : _type(type)
+{
+	std::cout << this->_type << " AMateria constructed" << std::endl;
+}
+
+AMateria::AMateria( const AMateria & src ) : _type(src._type)
+{
+	std::cout << this->_type << " AMateria constructed" << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+AMateria::~AMateria()
+{
+	std::cout << this->_type << "AMateria destroyed" << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+void AMateria::use(ICharacter& target) {
+	std::cout << this->_type << " In tour face ! Or mine ? Should i use on mine ... ?" << std::endl;
+}
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+std::string const & AMateria::getType() const {
+	return this->_type;
+}
+
+
+/* ************************************************************************** */

+ 97 - 0
Module_04/ex03/srcs/Character.cpp

@@ -0,0 +1,97 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Character.cpp                                      :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/19 16:40:56 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/20 04:06:23 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Character.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+Character::Character() : _name("Noname")
+{
+	for (int i = 0; i < 4; i++)
+        this->_items[i] = NULL;
+}
+
+Character::Character( const Character & src ) : _name(src._name)
+{
+	for (int i = 0; i < 4; i++)
+        this->_items[i] = src._items[i]->clone();
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+Character::~Character()
+{
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+
+Character &				Character::operator=( Character const & rhs )
+{
+	if ( this != &rhs )
+	{
+		for (int i = 0; i < 4; i++)
+ 	       this->_items[i] = rhs._items[i]->clone();
+	}
+	return *this;
+}
+
+std::ostream &			operator<<( std::ostream & o, Character const & i )
+{
+	o << i.getName();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+
+void Character::equip(AMateria* m) {
+	for (int i = 0; i < 4; i++)
+		if (!this->_items[i]) {
+			this->_items[i] = m;
+		}
+}
+
+void Character::unequip(int idx) {
+	if (this->_items[idx]) {
+		delete this->_items[idx];
+		this->_items[idx] = NULL;
+	}
+}
+
+void Character::use(int idx, ICharacter& target) {
+	if (this->_items[idx]) {
+		this->_items[idx]->AMateria::use(target);
+	}
+
+}
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+std::string const & Character::getName() const {
+	return this->_name;
+}
+
+/* ************************************************************************** */

+ 70 - 0
Module_04/ex03/srcs/Cure.cpp

@@ -0,0 +1,70 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Cure.cpp                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/19 15:29:40 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/19 16:20:46 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Cure.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+Cure::Cure() : AMateria("ice")
+{
+	std::cout << "ice AMateria construct" << std::endl;
+}
+
+Cure::Cure( const Cure & src ) : AMateria(src._type)
+{
+	std::cout << "ice AMateria construct" << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+Cure::~Cure()
+{
+	std::cout << "ice AMateria destructed" << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+std::ostream &			operator<<( std::ostream & o, Cure const & i )
+{
+
+	o << "Type = " << i.getType();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+AMateria* Cure::clone() const {
+	return (new Cure(*this));
+}
+
+void Cure::use(ICharacter& target) {
+	std::cout << "* heals " << target << "'s wounds *" << std::endl;
+}
+
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+
+/* ************************************************************************** */

+ 70 - 0
Module_04/ex03/srcs/Ice.cpp

@@ -0,0 +1,70 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Ice.cpp                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/12/19 15:29:40 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/19 16:11:17 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Ice.hpp"
+
+/*
+** ------------------------------- CONSTRUCTOR --------------------------------
+*/
+
+Ice::Ice() : AMateria("ice")
+{
+	std::cout << "ice AMateria construct" << std::endl;
+}
+
+Ice::Ice( const Ice & src ) : AMateria(src._type)
+{
+	std::cout << "ice AMateria construct" << std::endl;
+}
+
+
+/*
+** -------------------------------- DESTRUCTOR --------------------------------
+*/
+
+Ice::~Ice()
+{
+	std::cout << "ice AMateria destructed" << std::endl;
+}
+
+
+/*
+** --------------------------------- OVERLOAD ---------------------------------
+*/
+
+std::ostream &			operator<<( std::ostream & o, Ice const & i )
+{
+
+	o << "Type = " << i.getType();
+	return o;
+}
+
+
+/*
+** --------------------------------- METHODS ----------------------------------
+*/
+
+AMateria* Ice::clone() const {
+	return (new Ice(*this));
+}
+
+void Ice::use(ICharacter& target) {
+	std::cout << "* shoots an ice bolt at " << target << " *" << std::endl;
+}
+
+
+/*
+** --------------------------------- ACCESSOR ---------------------------------
+*/
+
+
+/* ************************************************************************** */

+ 32 - 0
Module_04/ex03/srcs/main.cpp

@@ -0,0 +1,32 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   main.cpp                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/17 15:10:40 by bchanot           #+#    #+#             */
+/*   Updated: 2025/12/18 17:05:50 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Animal.hpp"
+#include "Dog.hpp"
+#include "Cat.hpp"
+#include "CatWrong.hpp"
+#include "AnimalWrong.hpp"
+
+#include <iostream>
+#include <limits>
+
+int main( void ) {
+	const AnimalWrong* meta = new AnimalWrong();
+const Animal* j = new Dog();
+const AnimalWrong* i = new CatWrong();
+std::cout << j->getType() << " " << std::endl;
+std::cout << i->getType() << " " << std::endl;
+i->makeSound(); //will output the cat sound!
+j->makeSound();
+meta->makeSound();
+return 0;
+}