「🏗️」 wip(PhoneBook): Started phonebook
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
obj/
|
||||
ex00/megaphone
|
||||
megaphone
|
||||
compile_commands.json
|
||||
.cache
|
||||
.direnv
|
||||
flake.lock
|
||||
|
@ -6,7 +6,7 @@
|
||||
# By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/10/25 16:09:27 by adjoly #+# #+# #
|
||||
# Updated: 2024/10/26 00:41:40 by adjoly ### ########.fr #
|
||||
# Updated: 2024/10/30 17:08:54 by adjoly ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@ -20,7 +20,8 @@ SRCSDIR = src/
|
||||
|
||||
INCLUDES = includes/
|
||||
|
||||
SRCS = main.cpp
|
||||
SRCS = PhoneBook.cpp \
|
||||
Contact.cpp
|
||||
|
||||
OBJS = $(addprefix $(OBJSDIR), $(SRCS:.cpp=.o))
|
||||
|
||||
|
@ -6,15 +6,33 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/26 00:41:12 by adjoly #+# #+# */
|
||||
/* Updated: 2024/10/26 00:44:00 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/10/31 13:26:17 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class Contact {
|
||||
private:
|
||||
|
||||
std::string _name;
|
||||
std::string _lastName;
|
||||
std::string _nickname;
|
||||
std::string _phoneNbr;
|
||||
std::string _darkestSecret;
|
||||
public:
|
||||
// Getter
|
||||
std::string getName();
|
||||
std::string getLastName();
|
||||
std::string getNickname();
|
||||
std::string getPhoneNbr();
|
||||
std::string getSecret();
|
||||
|
||||
// Setter
|
||||
void setName(std::string newName);
|
||||
void setLastName(std::string newLastName);
|
||||
void setNickname(std::string newNickName);
|
||||
void setPhoneNbr(std::string newPhoneNbr);
|
||||
void setSecret(std::string newSecret);
|
||||
};
|
||||
|
@ -6,15 +6,17 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/26 00:41:10 by adjoly #+# #+# */
|
||||
/* Updated: 2024/10/26 00:43:39 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/10/31 12:37:10 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Contact.hpp"
|
||||
|
||||
class PhoneBook {
|
||||
private:
|
||||
|
||||
Contact _contact[8];
|
||||
public:
|
||||
|
||||
};
|
||||
|
64
ex01/src/Contact.cpp
Normal file
64
ex01/src/Contact.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Contact.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/30 17:05:12 by adjoly #+# #+# */
|
||||
/* Updated: 2024/10/31 13:33:56 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Contact.hpp"
|
||||
#include <string>
|
||||
|
||||
std::string Contact::getName()
|
||||
{
|
||||
return (Contact::_name);
|
||||
}
|
||||
|
||||
std::string Contact::getLastName()
|
||||
{
|
||||
return (Contact::_lastName);
|
||||
}
|
||||
|
||||
std::string Contact::getNickname()
|
||||
{
|
||||
return (Contact::_nickname);
|
||||
}
|
||||
|
||||
std::string Contact::getPhoneNbr()
|
||||
{
|
||||
return (Contact::_phoneNbr);
|
||||
}
|
||||
|
||||
std::string Contact::getSecret()
|
||||
{
|
||||
return (Contact::_darkestSecret);
|
||||
}
|
||||
|
||||
void Contact::setName(std::string newName)
|
||||
{
|
||||
_name = newName;
|
||||
}
|
||||
|
||||
void Contact::setLastName(std::string newLastName)
|
||||
{
|
||||
_lastName = newLastName;
|
||||
}
|
||||
|
||||
void Contact::setNickname(std::string newNickname)
|
||||
{
|
||||
_nickname = newNickname;
|
||||
}
|
||||
|
||||
void Contact::setPhoneNbr(std::string newPhoneNbr)
|
||||
{
|
||||
_phoneNbr = newPhoneNbr;
|
||||
}
|
||||
|
||||
void Contact::setSecret(std::string newSecret)
|
||||
{
|
||||
_darkestSecret = newSecret;
|
||||
}
|
@ -1,15 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.cpp :+: :+: :+: */
|
||||
/* PhoneBook.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/26 00:20:32 by adjoly #+# #+# */
|
||||
/* Updated: 2024/10/26 00:44:17 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/10/31 13:27:11 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int main(int ac, char **av)
|
||||
#include <PhoneBook.hpp>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
}
|
Reference in New Issue
Block a user