I am working on the design for a piece of software that manages items.
The software has multiple product types - each with their own SKU and physical properties, the user dynamically adds these product types.
The software also has items (also dynamically added)- each item belongs to a product type (inheriting its specific properties). When a user adds an item they need to be able to choose the product type, the user can also add additional properties such as if the item is broken, open, or new and other properties.
In my current design I have a class of ProductType
, that has fields for all the properties for a product type. I also have a class of item
that has fields for the additional properties.
I am confused on how to get an object of class Item
to inherit the properties of a specific object of class productType
. Any advice would be appreciated. The design is in its first revision, so it can be changed pretty easily.
My first thought would be to store an array of ProductType
globally, and then when an item is created use a function to copy the fields. Would this work or is there a better way?