CPP00 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
Contact.cpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* Contact.cpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/03/31 13:34:57 by kamitsui #+# #+# */
9/* Updated: 2025/04/06 06:00:03 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
21#include "Contact.hpp"
22
28Contact::Contact() : firstName(""), lastName(""), nickName(""), phoneNumber(""), darkestSecret("") {}
29
35void Contact::setFirstName(const std::string &firstName) { this->firstName = firstName; }
36
42void Contact::setLastName(const std::string &lastName) { this->lastName = lastName; }
43
49void Contact::setNickName(const std::string &nickName) { this->nickName = nickName; }
50
56void Contact::setPhoneNumber(const std::string &phoneNumber) { this->phoneNumber = phoneNumber; }
57
63void Contact::setDarkestSecret(const std::string &darkestSecret) { this->darkestSecret = darkestSecret; }
64
70std::string Contact::getFirstName() const { return firstName; }
71
77std::string Contact::getLastName() const { return lastName; }
78
84std::string Contact::getNickName() const { return nickName; }
85
91std::string Contact::getPhoneNumber() const { return phoneNumber; }
92
98std::string Contact::getDarkestSecret() const { return darkestSecret; }
99
105bool Contact::isEmpty() const {
106 return firstName.empty() && lastName.empty() && nickName.empty() && phoneNumber.empty() && darkestSecret.empty();
107}
Contact Class
bool empty() const noexcept
bool isEmpty() const
Check if an object (contact) has empty member variable.
Definition Contact.cpp:105
std::string getLastName() const
Gets the last name
Definition Contact.cpp:77
void setFirstName(const std::string &firstName)
Sets first name of contact.
Definition Contact.cpp:35
std::string getDarkestSecret() const
Gets the darkest secret of contact.
Definition Contact.cpp:98
void setNickName(const std::string &nickName)
Sets the nick name of contact.
Definition Contact.cpp:49
std::string getPhoneNumber() const
Gets the phone number of contact.
Definition Contact.cpp:91
void setDarkestSecret(const std::string &darkestSecret)
Sets the darkest secret of contact.
Definition Contact.cpp:63
void setPhoneNumber(const std::string &phoneNumber)
Sets the phone number of contact.
Definition Contact.cpp:56
std::string getFirstName() const
Gets the first name of contact.
Definition Contact.cpp:70
Contact()
Default constractor for the Contact class.
Definition Contact.cpp:28
void setLastName(const std::string &lastName)
Sets last name of contact.
Definition Contact.cpp:42
std::string getNickName() const
Gets the nick name of contact.
Definition Contact.cpp:84