Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i created a menu driven console application
1. employee details
2. delete employee
3. edit employee

to add more then 1 employee in my application do i have to create different objects of the same employee class every time??

i cant figure out how to delete the employee when user goes for the 2nd option and even how to edit the employee?? any suggestions??
Posted
Updated 26-Feb-10 0:31am
v2

Now it depends on how you have created your employee class. if you have used separate strings for user's firstname, lastname, etc. then you have to create different objects. if you have used some arraylist or heap kind of mechanism in the class then you can add more than one employee.

for deleing emplyee you can show list of employees and ask to enter some id ,store the ids in array and then call the delete method accordingly.

and for update it is some tedious work to do if you want to do bulk updates

so, do it first, then if some error occurred you can post it here again...

happy coding...
 
Share this answer
 
The idea behind OOPS is to have different objects for one class.

You might need to track these objects using an Id or a collection or something. Once that is done, deleting and editing should be easy.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900