Enlarge a dynamic array (no vector<> allowed, class assignment)
<p>This is my first problem to ask about, please scrutinize me if necessary :)</p>

<p>I'm trying to solve a problem for a C++ class at school.  I have encountered an error I really can't grasp.  I'm in taking my baby steps in programming.</p>

<p>The assignment says: </p>

<ul>
<li><p>two classes,</p></li>
<li><p>inheritance mechanism used,</p></li>
<li><p>database holding students using dynamic memory allocation,</p></li>
<li><p>a way of enlarging the database without using advanced data structures,</p></li>
<li><p>overload stream operators for objects of created class.</p></li>
</ul>

<p>This is my code:</p>

<pre><code>#include &lt;conio.h&gt;
#include &lt;stdio.h&gt;
#include &lt;iostream&gt;
#include &lt;string.h&gt;

using namespace std;

class Person
{
protected:

    char Name[20];
    string Surname;
    int Age;

public:

    virtual void whoAmI()=0;

    friend ostream &amp;operator&lt;&lt; (ostream &amp;out_, Person &amp;s);             // stream overl.
    friend istream &amp;operator&gt;&gt; (istream &amp;in_, Person &amp;s);
    friend void resizeArr(Person* oldList, int oldSize, int newSize);  // array enlarge
};

class Student :public Person
{
public:
    Student(){}
    Student(char name[], string surname, int age )
    {
        strcpy(Name, name);
        Surname = surname;
        Age = age;
    }

    virtual void whoAmI()                   // basically replaced by overloaded ostream
    {
        //cout &lt;&lt; "I am a student\nMy name is " &lt;&lt; name &lt;&lt;" "&lt;&lt; surname &lt;&lt; "; I'm "&lt;&lt; age &lt;&lt; " years old.";
        cout &lt;&lt; Name &lt;&lt; endl;
        cout &lt;&lt; Surname &lt;&lt; endl;
        cout &lt;&lt; Age &lt;&lt; endl;
    }
};

istream &amp;operator&gt;&gt; (istream &amp;in_, Person &amp;s)   // through reference: stream object and overloading object
{
    cout &lt;&lt; "New student record: "&lt;&lt; endl;
    cout &lt;&lt; "Name: " &lt;&lt; endl;
    in_ &gt;&gt; s.Name;
    cout &lt;&lt; "Surname: " &lt;&lt; endl;
    in_ &gt;&gt; s.Surname;
    cout &lt;&lt; "Age: " &lt;&lt; endl;
    in_ &gt;&gt; s.Age;
    cout &lt;&lt; endl;
    return in_;
}

ostream &amp;operator&lt;&lt; (ostream &amp;out_, Person &amp;s)
{
    out_ &lt;&lt; "Name:\t\t" &lt;&lt; s.Name &lt;&lt; endl &lt;&lt; "Surname:\t" &lt;&lt; s.Surname &lt;&lt; endl &lt;&lt;"Age:\t\t" &lt;&lt; s.Age &lt;&lt; endl;
    return out_;
}

void resizeArr(Student* oldList, int oldSize, int newSize)
{
    Student *newList = new Student[newSize];

    for(int i = 0; i &lt; oldSize; i++)            // COPYING
    {
        newList[i]=oldList[i];
    }

    for(int i = oldSize ; i &lt; newSize ; i++)    // init rest as blank students to avoid errors
    {
        newList[i] = Student( "undef" , "undef", 0);
    }

    delete [] oldList;                          // free memory used for old array
    oldList = newList;                          // reset pointer to new array
}

int main()
{
    int initSize = 2;
    int plusSize = 4;

    Student *list1 = new Student[initSize];

    for (int i=0; i&lt;initSize; i++){                  // initialize each cell as a blank student
        list1[i] = Student(  "undef" , "undef", 0);
    }

    for (int i=0; i&lt;initSize; i++)                   // display initial array
    {
        cout &lt;&lt; list1[i] &lt;&lt; endl &lt;&lt; "------------------------------" &lt;&lt; endl;  // for the sake of console output clarity
    }

    resizeArr(list1, initSize, plusSize);           // FUNCTION CALL

    cout &lt;&lt; endl &lt;&lt; "\tEnlarger database: " &lt;&lt; endl &lt;&lt; endl;                    // for the sake of console output clarity

    for (int i=0; i&lt;plusSize; i++)               // display enlarged array
    {
        cout &lt;&lt; list1[i] &lt;&lt; endl &lt;&lt; "------------------------------" &lt;&lt; endl;  // for the sake of console output clarity
    }

    getch();
    return 0;
}
</code></pre>

<p>I have previously prototyped such a mechanism using integer arrays and it worked... now I'm getting a crash for an unknown reason.</p>

<p>Please point me in the right direction.</p>

<hr>

<p>Edit:</p>

<p>The program compiles and runs, the new array seems to hold the first two elements of the old array, and by the point it reaches the first new element, the program crashes (the memory cell seems to be trolling me and holds a smiley face).</p>

<p>The first two <code>Student</code> objects are copied, the third element causes an error:</p>

<p><a href="https://i.stack.imgur.com/KUJ8E.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KUJ8E.jpg" alt="image"></a></p>