fix: search() call the destructor of phone_book

This commit is contained in:
Camille Chauvet 2023-05-22 17:08:28 +00:00
parent dce65dcb84
commit 7bc9220a7a

View File

@ -3,6 +3,7 @@
#include <cstdlib>
#include <iostream>
#include <bits/stdc++.h>
#include <ostream>
#include <sstream>
#include <string>
#include "../include/PhoneBook.hpp"
@ -34,10 +35,9 @@ Contact* read_contact()
return (NULL);
return (new Contact(first_name, last_name, nickname, phone_number, darkest_secret));
}
Contact* search(PhoneBook phone_book)
Contact* search(PhoneBook &phone_book)
{
int index;
std::string index_str;
@ -60,7 +60,6 @@ int main()
Contact* contact;
PhoneBook phone_book;
phone_book = PhoneBook();
while (true)
{
std::cout << "command: ";