When you create an instance of "client", you get two new rows: one in the table
"client", a second in the table "person".
Now you want to create an "employee" that uses the row in table "person" as well as
the "client" does, right?
This is not possible. In fact it's wrong. Logically the client-object consists of two rows.
An employee consist of two rows, one in table "employee", a second in table "person".
My suggestion: Do not use inheritance. Use Delegation. Have three classes
"person", "client" and "employee" and a one-to-one association between client and
person on the one hand and a one-to-one association between employee and
person.
That way a client "is a" person and an employee "is a" person. Both point to the same
person, and you have just one row in table "person".
Hope this helps.
Erik
|