Searching for simplest solution where a User can order an item.
If someone purchases an item he will have one address. Which then is the invoice and shipping address. But he could add another address if the invoice address is different from the shipping address.
I wrote some code with two Classes
Address. Where Purchase has a one-to-many relation with Address. So far so good and that all works fine.
But now, I might have a confusion.
I was thinking I could also create a
AbstractAddress class. Where
Purchase extends the
Address also extends the
AbstractAddress. Now if there is a
new Purchase the Address will be part of Purchase and the relation (one-to-many) from Purchase to Address will only happen if the Purchase get's added one more Address.
Is that correct? Would that be better? Could anyone please shed some light on this?