$25
1) What is the difference between: a) a type and an instance
b) a function definition and a function call
c) a struct and a class
d) a parameter and an argument
e) a property and a method
2) Think of a real-world object and its properties. Make up some actions or behaviors that the object might be able to perform. Write them in plain English.
3) Using a struct, create a new type for the real-world object you thought of for 2) with the properties and methods you thought of. Remember to mark each property with a let or var depending on whether or not it will be allowed to change. If you are not sure how to implement the body of one of the methods, describe what the method should do in a comment.
Use the stuct to make a new instance of your type.
Hint: If you made any properties with custom types, you can create placeholder types that have empty implementations. (See the TrainingShoe example)
4) Write your own Date type with the following properties / methods
Properties
Methods
month
asShortString() - String
day
asLongString() - String
year
dateAfter(days : Int) - Date
It should have an initializer that takes month, day, and year as Integers.
Here is an example of how to use this class: