「✨」 feat(Ex02): Finished
This commit is contained in:
42
ex02/AAnimal.cpp
Normal file
42
ex02/AAnimal.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* AAnimal.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/01 19:14:27 by adjoly #+# #+# */
|
||||
/* Updated: 2024/12/06 16:23:53 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "AAnimal.hpp"
|
||||
|
||||
AAnimal::AAnimal(void) {
|
||||
log("➕", "AAnimal", "", "construtor called");
|
||||
}
|
||||
|
||||
AAnimal::~AAnimal() {
|
||||
log("➖", "AAnimal", _type, "destructor called");
|
||||
}
|
||||
|
||||
AAnimal::AAnimal(std::string type) : _type(type) {
|
||||
log("➕", "AAnimal", type, "construtor called");
|
||||
}
|
||||
|
||||
AAnimal::AAnimal(const AAnimal &cpy) {
|
||||
log("➕", "AAnimal", _type, "copy construtor called");
|
||||
*this = cpy;
|
||||
}
|
||||
|
||||
AAnimal &AAnimal::operator=(const AAnimal &cpy) {
|
||||
log("🟰", "AAnimal", _type, "copy assignment construtor called");
|
||||
if (this != &cpy) {
|
||||
_type = cpy._type;
|
||||
}
|
||||
return (*this);
|
||||
}
|
||||
|
||||
std::string AAnimal::getType(void) const {
|
||||
return (_type);
|
||||
}
|
32
ex02/AAnimal.hpp
Normal file
32
ex02/AAnimal.hpp
Normal file
@ -0,0 +1,32 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* AAnimal.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/30 16:33:08 by adjoly #+# #+# */
|
||||
/* Updated: 2024/12/06 16:24:03 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "Log.hpp"
|
||||
|
||||
class AAnimal {
|
||||
protected:
|
||||
std::string _type;
|
||||
|
||||
public:
|
||||
AAnimal(void);
|
||||
AAnimal(std::string);
|
||||
virtual ~AAnimal(void);
|
||||
AAnimal(const AAnimal &);
|
||||
virtual AAnimal &operator=(const AAnimal &);
|
||||
|
||||
virtual std::string getType(void) const;
|
||||
|
||||
virtual void makeSound(void) const = 0;
|
||||
};
|
BIN
ex02/Abstract
Executable file
BIN
ex02/Abstract
Executable file
Binary file not shown.
36
ex02/Brain.cpp
Normal file
36
ex02/Brain.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Brain.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/06 11:47:20 by adjoly #+# #+# */
|
||||
/* Updated: 2024/12/06 15:53:11 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Brain.hpp"
|
||||
|
||||
Brain::Brain(void) {
|
||||
log("➕", "Brain", "", "construtor called");
|
||||
}
|
||||
|
||||
Brain::~Brain(void) {
|
||||
log("➖", "Brain", "", "destructor called");
|
||||
}
|
||||
|
||||
Brain::Brain(const Brain &cpy) {
|
||||
log("➕", "Brain", "", "copy construtor called");
|
||||
*this = cpy;
|
||||
}
|
||||
|
||||
Brain &Brain::operator=(const Brain &cpy) {
|
||||
log("🟰", "Brain", "", "copy assignment construtor called");
|
||||
if (this != &cpy) {
|
||||
for (uint i = 0; i < 100; i++) {
|
||||
this->_ideas[i] = cpy._ideas[i];
|
||||
}
|
||||
}
|
||||
return (*this);
|
||||
}
|
26
ex02/Brain.hpp
Normal file
26
ex02/Brain.hpp
Normal file
@ -0,0 +1,26 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Brain.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/06 11:35:05 by adjoly #+# #+# */
|
||||
/* Updated: 2024/12/06 15:53:18 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "Log.hpp"
|
||||
|
||||
class Brain {
|
||||
public:
|
||||
Brain(void);
|
||||
~Brain(void);
|
||||
Brain(const Brain &);
|
||||
Brain &operator=(const Brain &);
|
||||
|
||||
std::string _ideas[100];
|
||||
};
|
48
ex02/Cat.cpp
Normal file
48
ex02/Cat.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Cat.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/01 19:49:11 by adjoly #+# #+# */
|
||||
/* Updated: 2024/12/06 16:09:23 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Cat.hpp"
|
||||
|
||||
Cat::Cat(void) : AAnimal("Cat"){
|
||||
_brain = new Brain();
|
||||
log("➕", "Cat", "", "construtor called");
|
||||
}
|
||||
|
||||
Cat::~Cat(void) {
|
||||
delete _brain;
|
||||
log("➖", "Cat", "", "destructor called");
|
||||
}
|
||||
|
||||
Cat::Cat(const Cat &cpy) : AAnimal("Cat"){
|
||||
log("➕", "Cat", _type, "copy construtor called");
|
||||
*this = cpy;
|
||||
}
|
||||
|
||||
Cat &Cat::operator=(const Cat &cpy) {
|
||||
log("🟰", "Cat", "", "copy assignment construtor called");
|
||||
if (this != &cpy) {
|
||||
this->_type = cpy._type;
|
||||
}
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void Cat::makeSound(void) const {
|
||||
log("🔊", "Cat", "", "Mmmmmmeeeeeeeeoooooooowwwwww");
|
||||
}
|
||||
|
||||
void Cat::setIdea(std::string idea, uint i) {
|
||||
_brain->_ideas[i] = idea;
|
||||
}
|
||||
|
||||
std::string Cat::getIdea(uint i) {
|
||||
return (_brain->_ideas[i]);
|
||||
}
|
30
ex02/Cat.hpp
Normal file
30
ex02/Cat.hpp
Normal file
@ -0,0 +1,30 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Cat.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/01 19:06:08 by adjoly #+# #+# */
|
||||
/* Updated: 2024/12/06 16:08:59 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "AAnimal.hpp"
|
||||
#include "Brain.hpp"
|
||||
|
||||
class Cat : public AAnimal {
|
||||
private:
|
||||
Brain *_brain;
|
||||
public:
|
||||
Cat(void);
|
||||
~Cat(void);
|
||||
Cat(const Cat &);
|
||||
Cat &operator=(const Cat &);
|
||||
|
||||
void makeSound(void) const;
|
||||
void setIdea(std::string, uint);
|
||||
std::string getIdea(uint);
|
||||
};
|
48
ex02/Dog.cpp
Normal file
48
ex02/Dog.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Dog.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/01 20:05:21 by adjoly #+# #+# */
|
||||
/* Updated: 2024/12/06 16:09:36 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Dog.hpp"
|
||||
|
||||
Dog::Dog(void) : AAnimal("Dog"){
|
||||
_brain = new Brain();
|
||||
log("➕", "Dog", "", "construtor called");
|
||||
}
|
||||
|
||||
Dog::~Dog(void) {
|
||||
delete _brain;
|
||||
log("➖", "Dog", "", "destructor called");
|
||||
}
|
||||
|
||||
Dog::Dog(const Dog &cpy) : AAnimal("Dog"){
|
||||
log("➕", "Dog", _type, "copy construtor called");
|
||||
*this = cpy;
|
||||
}
|
||||
|
||||
Dog &Dog::operator=(const Dog &cpy) {
|
||||
log("🟰", "Dog", "", "copy assignment construtor called");
|
||||
if (this != &cpy) {
|
||||
this->_type = cpy._type;
|
||||
}
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void Dog::makeSound(void) const {
|
||||
log("🔊", "Dog", "", "woof");
|
||||
}
|
||||
|
||||
void Dog::setIdea(std::string idea, uint i) {
|
||||
_brain->_ideas[i] = idea;
|
||||
}
|
||||
|
||||
std::string Dog::getIdea(uint i) {
|
||||
return (_brain->_ideas[i]);
|
||||
}
|
30
ex02/Dog.hpp
Normal file
30
ex02/Dog.hpp
Normal file
@ -0,0 +1,30 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Dog.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/01 20:06:20 by adjoly #+# #+# */
|
||||
/* Updated: 2024/12/06 16:08:53 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "AAnimal.hpp"
|
||||
#include "Brain.hpp"
|
||||
|
||||
class Dog : public AAnimal {
|
||||
private:
|
||||
Brain *_brain;
|
||||
public:
|
||||
Dog(void);
|
||||
~Dog(void);
|
||||
Dog(const Dog &);
|
||||
Dog &operator=(const Dog &);
|
||||
|
||||
void makeSound(void) const;
|
||||
void setIdea(std::string, uint);
|
||||
std::string getIdea(uint);
|
||||
};
|
22
ex02/Log.cpp
Normal file
22
ex02/Log.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* log.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/30 16:30:53 by adjoly #+# #+# */
|
||||
/* Updated: 2024/11/30 16:32:37 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
void log(std::string emoji, std::string what, std::string who, std::string str) {
|
||||
if (who.empty())
|
||||
std::cout << "「" << emoji << "」" << what << ": " << str << std::endl;
|
||||
else
|
||||
std::cout << "「" << emoji << "」" << what << "(" << who << "): " << str << std::endl;
|
||||
}
|
||||
|
19
ex02/Log.hpp
Normal file
19
ex02/Log.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* log.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/06 12:01:21 by adjoly #+# #+# */
|
||||
/* Updated: 2024/12/06 13:12:13 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
void log(std::string, std::string, std::string, std::string);
|
56
ex02/Makefile
Normal file
56
ex02/Makefile
Normal file
@ -0,0 +1,56 @@
|
||||
# **************************************************************************** #
|
||||
# #
|
||||
# ::: :::::::: #
|
||||
# Makefile :+: :+: :+: #
|
||||
# +:+ +:+ +:+ #
|
||||
# By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/10/25 16:09:27 by adjoly #+# #+# #
|
||||
# Updated: 2024/12/06 16:11:18 by adjoly ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
SHELL = bash
|
||||
|
||||
NAME = Abstract
|
||||
|
||||
CC = c++
|
||||
|
||||
OBJSDIR = obj/
|
||||
|
||||
SRCS = $(shell find . -name '*.cpp')
|
||||
|
||||
OBJS = $(addprefix $(OBJSDIR), $(SRCS:.cpp=.o))
|
||||
|
||||
FLAGS = -Wall -Werror -Wextra -std=c++98 -MMD -MP
|
||||
|
||||
RED = \033[0;31m
|
||||
GREEN = \033[0;32m
|
||||
YELLOW = \033[1;33m
|
||||
PURPLE = \e[0;35m
|
||||
NC = \033[0m
|
||||
DELETE = \x1B[2K\r
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
$(NAME): $(OBJS)
|
||||
@$(CC) $(FLAGS) $(OBJS) -o $(NAME)
|
||||
@printf "$(YELLOW)「✨」($(NAME)) Program compiled\n"
|
||||
|
||||
$(OBJSDIR)%.o: %.cpp
|
||||
@mkdir -p $(@D)
|
||||
@$(CC) $(FLAGS) -c $< -o $@
|
||||
@printf "$(DELETE)$(GREEN)「🔨」($<) Object compiled\n"
|
||||
|
||||
clean:
|
||||
@rm -f $(OBJS)
|
||||
@printf "$(DELETE)$(RED)「🗑️」($(OBJS)) Object deleted\n"
|
||||
|
||||
fclean: clean
|
||||
@rm -f $(NAME)
|
||||
@rm -Rf $(OBJSDIR)
|
||||
@printf "$(RED)「🗑️」($(NAME)) Program deleted\n"
|
||||
|
||||
re: fclean all
|
||||
|
||||
.PHONY: clean fclean all re
|
46
ex02/WrongAnimal.cpp
Normal file
46
ex02/WrongAnimal.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* WrongAnimal.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/01 19:14:27 by adjoly #+# #+# */
|
||||
/* Updated: 2024/12/04 13:56:34 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "WrongAnimal.hpp"
|
||||
|
||||
WrongAnimal::WrongAnimal(void) {
|
||||
log("➕", "WrongAnimal", "", "construtor called");
|
||||
}
|
||||
|
||||
WrongAnimal::~WrongAnimal() {
|
||||
log("➖", "WrongAnimal", _type, "destructor called");
|
||||
}
|
||||
|
||||
WrongAnimal::WrongAnimal(std::string type) : _type(type) {
|
||||
log("➕", "WrongAnimal", type, "construtor called");
|
||||
}
|
||||
|
||||
WrongAnimal::WrongAnimal(const WrongAnimal &cpy) {
|
||||
log("➕", "WrongAnimal", _type, "copy construtor called");
|
||||
*this = cpy;
|
||||
}
|
||||
|
||||
WrongAnimal &WrongAnimal::operator=(const WrongAnimal &cpy) {
|
||||
log("🟰", "WrongAnimal", _type, "copy assignment construtor called");
|
||||
if (this != &cpy) {
|
||||
_type = cpy._type;
|
||||
}
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void WrongAnimal::makeSound(void) const {
|
||||
log("🔊", "WrongAnimal", "", "making a wrong sound OOOOOOOOOOOOOOOoo");
|
||||
}
|
||||
|
||||
std::string WrongAnimal::getType(void) const {
|
||||
return (_type);
|
||||
}
|
33
ex02/WrongAnimal.hpp
Normal file
33
ex02/WrongAnimal.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* WrongAnimal.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/30 16:33:08 by adjoly #+# #+# */
|
||||
/* Updated: 2024/12/04 13:50:36 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class WrongAnimal {
|
||||
protected:
|
||||
std::string _type;
|
||||
|
||||
public:
|
||||
WrongAnimal(void);
|
||||
~WrongAnimal(void);
|
||||
WrongAnimal(std::string);
|
||||
WrongAnimal(const WrongAnimal &);
|
||||
WrongAnimal &operator=(const WrongAnimal &);
|
||||
|
||||
std::string getType(void) const;
|
||||
|
||||
void makeSound(void) const;
|
||||
};
|
||||
|
||||
void log(std::string, std::string, std::string, std::string);
|
38
ex02/WrongCat.cpp
Normal file
38
ex02/WrongCat.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* WrongCat.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/01 19:49:11 by adjoly #+# #+# */
|
||||
/* Updated: 2024/12/06 15:55:37 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "WrongCat.hpp"
|
||||
|
||||
WrongCat::WrongCat(void) : WrongAnimal("WrongCat"){
|
||||
log("➕", "WrongCat", "", "construtor called");
|
||||
}
|
||||
|
||||
WrongCat::~WrongCat(void) {
|
||||
log("➖", "WrongCat", "", "destructor called");
|
||||
}
|
||||
|
||||
WrongCat::WrongCat(const WrongCat &cpy) : WrongAnimal("WrongCat"){
|
||||
log("➕", "WrongCat", _type, "copy construtor called");
|
||||
*this = cpy;
|
||||
}
|
||||
|
||||
WrongCat &WrongCat::operator=(const WrongCat &cpy) {
|
||||
log("🟰", "WrongCat", "", "copy assignment construtor called");
|
||||
if (this != &cpy) {
|
||||
this->_type = cpy._type;
|
||||
}
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void WrongCat::makeSound(void) const {
|
||||
log("🔊", "WrongCat", "", "wwwwwwwwooooooooeeeeeeeeemmmmmmm");
|
||||
}
|
25
ex02/WrongCat.hpp
Normal file
25
ex02/WrongCat.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* WrongCat.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/01 19:06:08 by adjoly #+# #+# */
|
||||
/* Updated: 2024/12/06 15:55:47 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "WrongAnimal.hpp"
|
||||
|
||||
class WrongCat : public WrongAnimal {
|
||||
public:
|
||||
WrongCat(void);
|
||||
~WrongCat(void);
|
||||
WrongCat(const WrongCat &);
|
||||
WrongCat &operator=(const WrongCat &);
|
||||
|
||||
void makeSound(void) const;
|
||||
};
|
42
ex02/main.cpp
Normal file
42
ex02/main.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/06 11:20:59 by adjoly #+# #+# */
|
||||
/* Updated: 2024/12/06 16:21:49 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "AAnimal.hpp"
|
||||
#include "Dog.hpp"
|
||||
#include "Cat.hpp"
|
||||
|
||||
int main() {
|
||||
const AAnimal* dog = new Dog();
|
||||
Cat* cat = new Cat();
|
||||
|
||||
cat->setIdea("I want to eat", 0);
|
||||
cat->setIdea("I want to eat", 1);
|
||||
cat->setIdea("I want to eat", 2);
|
||||
cat->setIdea("I want to eat", 3);
|
||||
cat->setIdea("I want to eat", 4);
|
||||
cat->setIdea("I want to eat", 5);
|
||||
cat->setIdea("I want to eat", 6);
|
||||
dog->makeSound();
|
||||
cat->makeSound();
|
||||
log("🥩", "Idea", "Cat", cat->getIdea(0));
|
||||
log("🥩", "Idea", "Cat", cat->getIdea(1));
|
||||
log("🥩", "Idea", "Cat", cat->getIdea(2));
|
||||
log("🥩", "Idea", "Cat", cat->getIdea(3));
|
||||
log("🥩", "Idea", "Cat", cat->getIdea(4));
|
||||
log("🥩", "Idea", "Cat", cat->getIdea(5));
|
||||
log("🥩", "Idea", "Cat", cat->getIdea(6));
|
||||
|
||||
delete cat;
|
||||
delete dog;
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user