Need help with destructor and pointers

I got my program to initially work, but I realized I was supposed to add a destructor to my Employee class. So I went online to watch some tutorials and learn about destructors and realized I need pointers in which I didn't have initially. Here is my program, I can't seem to get my pointers to work now when i'm going back to add them for the destructor to work. Any help or advice would be appreciated.
Last edited on
Why are you trying to use pointers to strings in your class?

By the way you can't delete what you didn't new.

To be honest I didnt realize it was still string, thats how I had it before trying to add pointers. I'll go back and fix it now. Thanks!
I'll go back and fix it now.

I hope you mean you're going to remove all those silly pointers.
I went back and posted my original code I had before adding all the pointers, any suggestions on how I would add a destructor to my employee class?
You don't appear to need a destructor, the default compiler supplied constructor should work just fine since you no longer have any pointers in your class.

But you really should be using constructor initialization lists instead of the assignment in the body of the constructor.

http://en.cppreference.com/w/cpp/language/initializer_list


You also seem to be missing several required header file inclusions and using the "using namespace std; " clause in the global scope of a header is a very very bad practice.
Last edited on
Thanks for the help, I'll read what you posted. Also out of curiosity why is it bad practice?
Because any file that happens to include this file will then be using this directive, thus causing name clashes that would be hard to diagnose.
Topic archived. No new replies allowed.