I have a member function that I call, from there I get a pointer to a private member which is of class BankAccount, I am unsure what happens with the pointers when I deallocate them. I create a new pointer and heap memory address but then assign the pointer to something else. What does "delete" end up deleting?
I read that if you delete a pointer
Here is the code
void Employee::raise(){
    BankAccount* tempBank = new BankAccount(); //set pointer to new heap place
    double amt;
    tempBank = get_bank(); // set pointer to existing heap implicitly
    amt = tempBank->get_amount();
    amt = (amt + (amt/12));
    tempBank->set_amount(amt);
    delete tempBank; //does this delete new heap created or does it add a new block of
                     //memory to heap since it is trying to delete a pointer assigned 
                     //by memory address
    tempBank = NULL;
}
I realized I could just do the code below to avoid this situation, but now I am curious as to what happens in the above situation with the memory
BankAccount* tempBank = get_bank();
So what exactly happens when delete is called in my original situation?
 
     
     
     
     
     
     
     
    