Can any one plz provide some example how to implement dynamic memory allocation for employee record in the below example and how do i delete record from multiple records and how do i use this deleted memory again to reallocate other value.
the definition is to create employee class and provide member of class like eid,fname,lname age,etc and for name use dynamic memory allocation and when any employee left then memory would be recaptured and display total no. employee record with detail.
Well, first off you don't declare a destructor for your class. While normally you don't need to do this, if you are creating memory on the fly its a good idea to delete it when you are done, other wise you'll get whats called a "memory leak". so within the public section of your class, declare a destructor which deletes any memory allocated by new: