Question.8
A developer models a GPS module:
GPS
Option A -- Inheritance:
class GPS : public UART { /* GPS IS-A UART? */ };
Option B -- Composition:
class GPS { UART& uart; // GPS HAS-A UART public: GPS(UART& u) : uart(u) {} };
Which is correct?
Select Answer
Option A
Option B
Both are equivalent
Neither is valid