define destructure for employee class |
By this do you mean a destructor? If so you can provide a destructor that uses
delete
on anything that was created with
new
inside the class. Use
delete
in main or elsewhere objects are created with
new
and also i don't want to use stl library for employee operations like store info. delete info. display info. |
These can be ordinary functions - although what is your objection to using things like push_back to put objects into vectors?
all things i wanna do with only dynamic memory but how?? |
That is what I was talking about with this remark.
Have the class Employee which just stores the info & has suffient functions to access the private members. Next have another class which has a <vector> or <list > of the employee objects. This class provides the functions to carry out operations on individual employee objects or all of them. |
You know how to create a class, so create a CEmployeeVtr or CEmployeeList, which would use a <vector> or <list> respectively. I prepend my class name with "C" - it makes it easier to name objects. It is also a good idea to prepend member variables with "m_".
You will need to create a function that retrieves a particular Employee record. You can then write all your other functions that work with Employee objects.
Can anyone plz share code so that i can implement it with better understanding.
|
I think it is your job to write the code - we can give hints & ideas.
Finally, it is normal to put the class declaration in a header file, while the implementation goes in a .cpp file.