• Post Reply Bookmark Topic Watch Topic
  • New Topic

Not sure how to sort through objects  RSS feed

 
brett rippetoe
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a base class
Employee which has subclasses Office, Laborer, Manager

I have no problem with this, my problem is how to connect them based on direct supervisor and what dept. they are in?

Do I do this with a separate class or have each employee send params into the manager in a hashmap that keeps track of them?

I just don't know how to accomplish this, so if you have something that I can read I would greatly appreciate it.

I need to keep track of the hierarchy I think is what my problem is, and I don't understand what is meant by levels deep?
 
Bin Smith
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

You have your class Employee that represents base class for every type of Employee.
So base class should keep data common to all subtypes as well as functionality(methods)!

As every type of Employee has director and department it is reasonable to store this data inside base Employee class.

Create separate classes that represent Director and Department and put inside Employee class reference to Director and Department.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!