T
T
TheRevan2021-05-17 05:57:09
OOP
TheRevan, 2021-05-17 05:57:09

How to associate a class with a qualifying class?

There is a Ship class (a ship)
There is a ShipType class (a type of ship with its characteristics - well, there is speed, maneuverability, etc.)
Do I need to store ShipType in my Ship, or is it better to do it through the shipTypeId field?
Do I need to store the id in the Ship itself?
Or, in principle, pass the ShipType object to the Ship constructor and from it write all the fields with ShipType into similar fields (speed / maneuverability, etc.)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
HemulGM, 2021-05-17
@TheRevan

There is a class - a ship. The ship has a property - type, i.e. just the Type field.
You know the type - you know all the parameters

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question