It's been about a year since I've used C++, and I'm having a weird error that I can't remember why it does this, or if there's actually something wrong. My destructor gets called twice when I declare my object via the first method, and only once (correctly) when it declare it the 2nd time.
Wrong, destructor gets called twice.
Hash h;
h = new Hash(string);
Destructor gets called once.
Hash h = new Hash(string);
I remember about the copy constructor and assignment operator. And I have them both implemented I assume correctly. But I'm not sure what the deal is. I'm sure it's something stupid that writing in evil Java makes me forget.
Hash::Hash(const Hash& other){
this->Map = other.Map;
}
Hash& Hash::operator=(const Hash& other){
if (this != &other){
this->Map=other.Map;
}
return *this;
}