OOP: How to implement listing al 'Employees'.
Petar
perosine at gmail.com
Fri Dec 28 07:05:59 EST 2007
I was just wondering.
What if you have a 'Employees' class and you want to list all the
employees. Currenlty i'm seeing to possibilities:
- create a 'listAll' function inside the class which returns all the
employees in a array.
- create multiple instances, putting them in a array, by calling the
Employees class multiple times in a loop (thus not creating a listAll
function in the class).
What is the better way of doing this? And should a class always
reference only on 'item'?
Thank in advance.
More information about the Python-list
mailing list