Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Papa dev #1

Open
wants to merge 2 commits into
base: SAMDEV
Choose a base branch
from
Open

Conversation

albinopapa
Copy link

I may have went a little overboard, but the main point is the deep copy of 'char* s' to 'char* Person::buffer' ( lines 140 - 150 ) as well as how the serialization should be. ( lines 172 - 181 ).

To perform the deep copy, you need to either do what I did and allocate on the heap with operator new[] or store a c-style array of 'char buffer[ string_length_max + 1 ] in Person. If you choose the operator new[] route like I did, then you also need to call operator delete[] for each Person objects' buffer. This is why there is now a constructor and destructor. in Person.

The Database class is just a storage and interface class for the Person object list. I think it tidies up the main code a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant