As stated in the title, I am faced with a situation where I have two classes: SimplifiedBill
, which includes only date and finalPayment, and Bill
, which has the same properties as SimplifiedBill
but also additional details such as taxes, user data, and services.
One possible solution could be for Bill
to inherit from SimplifiedBill
. However, I believe this approach may not be conceptually accurate because SimplifiedBill
is essentially derived from Bill
; therefore, Bill
does not inherit anything from SimplifiedBill
.
Do you have any suggestions on how to design the classes in this scenario?
EDIT:
The process works as follows.
I retrieve a list of SimplifiedBill
objects from the backend. When I select one of these objects, I then fetch the corresponding Bill
from the API to view its details.
In case you are curious, I am using Angular. I have a ListComponent
(or view) that displays my SimpleBill
objects. Clicking on an object takes me to the DetailComponent
, where I can view the specific Bill
. Unfortunately, when transitioning between views, I am unable to transfer the entire SimpleBill
object; I can only pass its ID or another field.