**just realized my topic title makes no sense.. apologize ahead of time.
I'm having a hard time with this code.. plz help me out..
Code:
#include<iostream>
using namespace std;
char input[101];
class NameAdd
{
char* name;
char* address;
public:
NameAdd() {
this->name = "my_name";
this->address = "my_address";
}
~NameAdd()
{
cout << "Deleting the base!!!" << endl;
delete this->name; delete this->address;
}
};
class amountnum : virtual public NameAdd
{
char* amount;
public:
amountnum()
{
this->amount = "a_amount";
}
~amountnum()
{
cout << "Deleting the osap!!!" << endl;
delete this->amount;
}
};
int main()
{
NameAdd * formlist[5];
int limit = 1;
formlist[limit] = new amountnum();
system("pause");
delete formlist[limit];
cout << "success!" <<endl;
system("pause");
return 0;
}
i know the delete isn't working. i was hoping someone could shine some light as to whats wrong.