Exercise: Insert a User into UserDB

Description

The original C implementation to insert a User into the database is declared as follows,

void userdb_insert(struct UserDB* userdb, struct User*);

In C, This is as pretty as it can get. In C++, we can do better.

In class UserDB, implement a method

class UserDB
{
public:
    ...
    void insert(const User& user);
    ...
};

That method simply appends user to the std::vector that we created in Exercise: Use std::vector in UserDB.

Test this using the following program (feel free to use your own version of it):

#include "userdb.h"
#include <iostream>

int main()
{
    UserDB db;
    User joerg("Joerg", "Faschingbauer", 55);
    db.insert(joerg);
    return 0;
}