I would like to overload the assignment operator ( operator=
), I know I have to reserve memory, and copy data from one to the other, however I do not know how to copy one vector to the other without knowing the size of it .
class Perfil{
private:
char letra;
vector <Carateristica*> carateristicas;
}
Perfil & Perfil::operator=(const Perfil & p1)
{
letra = p1.getLetra();
// Agora deveria reservar memoria utilizando o new
// e copiar os dados de um vector para o outro
(..)
}