diff options
Diffstat (limited to 'cpp00/ex01/PhoneBook.cpp')
| -rw-r--r-- | cpp00/ex01/PhoneBook.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/cpp00/ex01/PhoneBook.cpp b/cpp00/ex01/PhoneBook.cpp index a47307f..a28ce36 100644 --- a/cpp00/ex01/PhoneBook.cpp +++ b/cpp00/ex01/PhoneBook.cpp @@ -6,23 +6,23 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/13 07:23:13 by charles #+# #+# */ -/* Updated: 2020/04/13 08:43:05 by charles ### ########.fr */ +/* Updated: 2020/11/09 09:29:37 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include "PhoneBook.hpp" -PhoneBook::PhoneBook(): m_size(0) -{ -} +PhoneBook::PhoneBook() : m_size(0) {} void PhoneBook::add(Contact contact) { + if (m_size >= CONTACTS_SIZE) + return; m_contacts[m_size] = contact; m_size++; } -Contact const &PhoneBook::get(int index) const +Contact const& PhoneBook::get(size_t index) const { return m_contacts[index]; } @@ -32,7 +32,7 @@ size_t PhoneBook::getSize() const return m_size; } -std::ostream &operator<<(std::ostream &out, PhoneBook const &p) +std::ostream& operator<<(std::ostream& out, PhoneBook const& p) { for (size_t i = 0; i < p.getSize(); i++) { |
