I am a bit confused about class diagrams and ER diagrams in databases. I know how they are different, but I am stuck in one aspect. In an ER diagram if you have a 1…n relationship (say a department has many employees) then the primary key of department goes into the employee entity.
In a class diagram, should I do the same? Or should I have an operation under department entitled getemployees(D:Department) as otherwise information of the department class would go into employee, violating the encapsulation rule?
I look forward to hearing from you soon.
Thanks in advance.