It's time to practice! Using what you've learned in the previous articles, create an App that meets the following requirements:
- Create a collection of objects that represent different types of vehicles.
- Use protocols to define the types of vehicles with different properties and functions.
- GasCar: numberOfWheels, startEngine()
- ElectricCar: numberOfWheels, plug()
- Truck: numberOfWheels, startEngine()
- Use the following protocols.
- Vehicle
- Gas
- Electric
- Delivery
- Avoid using inheritance.
- Create a list of
Vehicle
. - Call
startEngine()
of eachVehicle
of your array.
Be the first to comment