Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 779 Bytes

File metadata and controls

19 lines (14 loc) · 779 Bytes

Single-responsibility principle

In short:

Every module, class, or function in a computer program should have responsibility over a single part of that program's functionality.

source

Assignment

A car is made out of separate smaller parts. Two of these parts are wheels and the steering wheel.

Task 1

Note the two interfaces in this folder: WheelInterface and SteeringWheelInterface. Following the single responsibility principle, write a class that accepts objects implementing the WheelInterface and SteeringWheelInterface and constructs a new to be created object Car.

Note: a car can have one steering wheel and no more than four wheels.