/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* MateriaTemplate.hpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/12/11 10:59:31 by adjoly #+# #+# */ /* Updated: 2024/12/11 12:06:51 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ #pragma once #include "AMateria.hpp" #include "Log.hpp" template class MateriaTemplate : public AMateria { public: MateriaTemplate(void); ~MateriaTemplate(void); MateriaTemplate(T const &); T &operator=(const T &); AMateria *clone(void) const; }; template MateriaTemplate::MateriaTemplate(void) : AMateria(T::_typeName()) { log("➕", T::_typeName(), "", "default constructor called"); } template MateriaTemplate::~MateriaTemplate(void) { log("➖", T::_typeName(), "", "destructor called"); } template MateriaTemplate::MateriaTemplate(T const &cpy) { *this = cpy; log("➕", T::_typeName(), "", "copy constructor called"); } template T &MateriaTemplate::operator=(const T &cpy) { log("➕", T::_typeName(), "", "copy assignement constructor called"); if (this != &cpy) { this->_type = cpy._type; } return (*this); } template AMateria *MateriaTemplate::clone(void) const { return (new T); }