Multiple Inheritance
A true Object-Oriented Solar_System
The purpose of this exercise is to rewrite the previous exercise using OOP.
Remember that privacy is still important!
Expected result
Question 1
Class diagram for Q.1 and Q.2
Create a hierarchy of interfaces as follows
Orbit_Ref_Ias an interface implementingGet_XandGet_Y(can be used as an orbit reference)Movable_Ias an interface implementing aMoveprocedureOrbiting_Body_Ias an interface implementingOrbit_Ref_IandMovable_IStill_Body_Ias an interface implementingOrbit_Ref_ISolar_System_Ias an interface implementingAdd_Still_BodyandAdd_Moving_Bodyprocedures andMovable_I
Question 2
Create a hierarchy of tagged types as follows
Body_Base_Tto store a position (X,Y) and implementingOrbit_Ref_IOrbiting_Body_Tas a concrete object extendingBody_Base_Tto storeDistance,Speed,AngleandTurns_Aroundand implementingOrbiting_Body_IStill_Body_Tas a concrete object extendingBody_Base_Tand implementingStill_Body_ISolar_System_Tas a concrete object implementingSolar_System_Iable to store a vector of moving bodies and a vector of still bodies
Question 3
Class diagram for Q.3, Q.4 and Q.5
Add constructor primitives in order to create concrete types returning a pointer to the newly allocated object
Create_Orbitingreturning an access toOrbiting_Body_TCreate_Stillreturning an access toStill_Body_TCreate_Solar_Systemreturning an access toSolar_System_T
Question 4
In a specific Graphics package extend the capabilities of our object using decorator design pattern.
Create an interface
Drawable_Iimplementing aDrawprocedureDefine
Visible_Body_Decorator_Tas an abstract type implementingDrawable_IandStill_Body_I. This type will store graphic information.Define
Visible_Orbiting_Body_TextendingVisible_Body_Decorator_Tand implementingMovable_IDefine
Visible_Still_Body_TextendingVisible_Body_Decorator_TDefine
Visible_Solar_System_TimplementingDrawable_IandSolar_System_I
Question 5
Add constructor
Create_VisibletoVisible_Orbiting_Body_TAdd constructor
Create_VisibletoVisible_Still_Body_TAdd constructor
Create_VisibletoVisible_Solar_System_T
Question 6
Make it work ! ;)