Question: 1) The orange represent classes while the white represent objects (instantiations) of the above class. You can see the natural hierarchy of the classes, and
1) The orange represent classes while the white represent objects (instantiations) of the above class. You can see the natural hierarchy of the classes, and where inheritance could exists... E.g. a machine gun is a type of rifle, which is a weapon (so rifle would inherit from weapons, and machine gun would inherit from rifle). PKM and M240 are examples of machine guns. Think about items that you work with (from work/home/etc.) and create an example of your own hierarchy showing possible class definitions and inheritance.

2) For the hierarchy you created in #1, list some data fields that would be appropriate for each level of class. An example is given below
Weapon name, round size, manufacturer, range
Rifle, inherits from weapon and adds barrel length, stock type (wood, etc.)
Machine Gun: inherits from Rifles and adds ->capacity, rate of fire
Assault: inherits from Rifles and adds-> cartridge type, selection of rate (single, auto, etc)
Sniper: inherits from Rifle and adds -> scope type, silencer?
Pistols \begin{tabular}{|c|} \hline Glock 19 \\ \hline Sig Sauer P320 \\ \hline Smith&WessonM&P \\ \hline \end{tabular}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
