Ok, I converted my SLL into a DLL. However, this is the first time I have created a DLL and I was hoping I could get some advice on my node deletion code...The code I have works, but for some reason it seems sloppy. Here is what I have:
Code:
void BankAccount::DeleteAccount()
{
if(pPrev == 0) // first node
{
pFirst = pNext;
pFirst->SetPrev(0);
}
else if(pNext == 0) // last node
{
BankAccount *pBA;
pBA = pPrev;
pBA->SetNext(0);
}
else // somewhere in the middle
{
BankAccount *pBA;
BankAccount *pBA2;
pBA = pPrev;
pBA2 = pNext;
pBA->SetNext(pNext);
pBA2->SetPrev(pPrev);
}
return;
};
I just put it together using logic, so I'm sure there is a more efficient way of doing it. If you have any suggestions, let me know. Thanks.