implementation phonebook class

This commit is contained in:
Hugo LAMY
2022-02-03 16:23:36 +01:00
parent aa77271631
commit 8abc2d30a9
7 changed files with 54 additions and 52 deletions

View File

@@ -1,6 +1,11 @@
#include "Contact.class.hpp"
Contact::Contact( void ) {
this->add_first("NOT DEFINED");
this->add_last("NOT DEFINED");
this->add_nick("NOT DEFINED");
this->add_num("NOT DEFINED");
this->add_secret("NOT DEFINED");
return;
}
@@ -8,32 +13,17 @@ Contact::~Contact( void ) {
return;
}
void Contact::add_first( std::string str ) {
this->first.assign(str);
return;
}
void Contact::add_last( std::string str ) {
this->last.assign(str);
return;
}
void Contact::add_nick( std::string str ) {
this->nick.assign(str);
return;
}
void Contact::add_num( std::string str ) {
this->num.assign(str);
return;
}
void Contact::add_secret( std::string str ) {
this->secret.assign(str);
return;
}
// ADD
void Contact::add_first( std::string str ) {this->first.assign(str);}
void Contact::add_last( std::string str ) {this->last.assign(str);}
void Contact::add_nick( std::string str ) {this->nick.assign(str);}
void Contact::add_num( std::string str ) {this->num.assign(str);}
void Contact::add_secret( std::string str ) {this->secret.assign(str);}
// GET
std::string Contact::get_first( void ) {return first;}
std::string Contact::get_last( void ) {return last;}
std::string Contact::get_nick( void ) {return nick;}
std::string Contact::get_num( void ) {return num;}
std::string Contact::get_secret( void ) {return secret;}
void Contact::print_contact( void ) {
std::cout << "FIRST NAME : " << this->first << std::endl;
std::cout << "LAST NAME : " << this->last << std::endl;
std::cout << "NICKNAME : " << this->nick << std::endl;
std::cout << "NUMBER : " << this->num << std::endl;
std::cout << "SECRET : " << this->secret << std::endl;
return;
}