EXERCISE
Represent the products of a business using protocol.
EXERCISE
Represent the products of a business using protocol.
0
0
Checkbox to mark video as read
Mark as read

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 each Vehicle of your array.

0 Comments

Join the community to comment
Sign Up
I have an account
Be the first to comment

Accept Cookies

We use cookies to collect and analyze information on site performance and usage, in order to provide you with better service.

Check our Privacy Policy