Object oriented programming Flashcards
1
Q
How to create a class?
A
2
Q
How do a subclass?
A
3
Q
How to do a initializer in a subclass?
A
4
Q
How to declare a computed variable?
A
- They have to be var
var area: Double {
return length * width
}
5
Q
What is a value type?
A
- A struct is a value type
- It is a type whose value is copied when it is assign to a variable, constant or passed to a function as parameter.
6
Q
What is a reference type?
A
- A class is a reference type
- It is a type whose value is not copied when it is assign to a variable, constant or passed to a function as parameter. Instead a reference to the instance is created
7
Q
What is a designatd initializer?
A
- It is the initializer that must be used when creating an instance of th class
8
Q
What is a convenience initializer?
A
- It is used when you want to give determined values to the properties of an instance that is a sublcass.
- It can only call the designated initializer of its class not the super.