How to read information from a text file into a dynamic array that is inside a constructor?
<p>To specify the question above, I'm taking a class to learn c++.  We recently just learned about dynamic arrays and classes.  In a recent assignment, we were suppose to take information from a text file and initialize specific cells of the dynamic array inside of a constructor with the given struct and class (which is shown below).  That being said, my problem is that whenever I try running the program it crashes.  </p>

<pre><code>class call_record
{
public:
    string firstname;
    string lastname;
    string cell_number;
    int relays;
    int call_length;
    double net_cost;
    double tax_rate;
    double call_tax;
    double total_cost;
};

class call_class
{
public:
    call_class();
    ~call_class();
    bool Is_empty();
    bool Is_full();
    int Search(const string key);
    void Add();
    void Remove(const string key);
    void Double_size();
    void Process();
    void Print();
private:
    int count;
    int size;
    call_record *call_DB;
};

// default constructor
call_class::call_class()
{

    size = 5;
    count = 0; 
    ifstream in; 
    in.open("callstats_data.txt");  

    while (!in.eof()) 
    {

        if(Is_full())
        {
            Double_size();
        }

        in &gt;&gt; call_DB[count].firstname
            &gt;&gt; call_DB[count].lastname
            &gt;&gt; call_DB[count].cell_number
            &gt;&gt; call_DB[count].relays
            &gt;&gt; call_DB[count].call_length;

        count++;  
    }

    in.close();  

}
</code></pre>

<p>To include more context, I found out that this problems arises mainly when I try reading a file into a dynamic array that is inside the constructor of a class.  I tried using a static array instead of a dynamic array and it worked with no problems at all; however, I can't really use a static array.  So I was wondering if there was specific way to place information from a text file into a dynamic array that is inside of a default constructor. </p>