Declared in arraystorage class, private: string *names;
ArrayStorage& ArrayStorage::operator=(const ArrayStorage& rhs)
{           
    // possible error
    names = new string[numOfElements];
    return *this;
}
//      copy constructor
ArrayStorage::ArrayStorage(const ArrayStorage& rhs):
                                 names(new string[numOfElements]),                                                      
                                 numOfElements(rhs.numOfElements)
{
    //names = new string[this->getNumOfElements()];
    for (int i = 0; i < this->getNumOfElements(); i++)
        names[i] = rhs.names[i];
}
ArrayStorage::~ArrayStorage(void)
{
    delete [] names;
}
================================ ArrayStorage.cpp==============================
My first problem, if I declare names as private, the whole thing doesn't work. It works if I put it as public.
Secondly, can you please advise, how do I make it work, if I want to declare string *names as private?
 
     
    