fix: search() call the destructor of phone_book
This commit is contained in:
parent
dce65dcb84
commit
7bc9220a7a
@ -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: ";
|
||||
|
Loading…
Reference in New Issue
Block a user