Lets say I have entities Member, Teacher, Student. Both Teacher and Student entities inherit from Member. If I create a Teacher Object is a identical Member object created as well? If I have a teacher-Overview form and a member-Overview form (with datagrids) will they both be displaying the created teacher object? This is something I came across in my current project, is the object duplicated? or just displayed twice?
2 answers

A Teacher is a Member, so it will show up in a datagrid of Members. If you create two datagrids, one with teachers and one with members, it will show up in both. It's the same object.


In general (all pun inteded) when you inherit from an object it depends on what lvl you create.

In your example:

Create a Member and you would just see the object in the MemberOverview Create a Teacher or a Student and they would end up both on their respective overviews AS WELL as on the MemberOverview

Obviously to appear on the MemberOverview you would need to have set at least one attribute in the MemberObject.

In essence you store the User-related atributes in the UserObject and the Teacher-related in the TeacherObject and when you look at it from the perspective of Teacher you would see ALL the data, as if there is just a Teacher record

Hope this helps