Search for tag: "setter"
Lesson 23.8 Properties (OPTIONAL)This video introduces an advanced topic that is completely optional and will not appear on any exam. Classes like RGB and Point3 appear to enforce their invariants without any getters and setters.…
From Hannah Lee
34 plays
|
|
Lesson23.4 The is OperatorAs we saw in the previous video, we cannot trust == if we need to test if two variables refer to the same object folder. In this video we show an alternative operator is, which is safe to use because…
From Hannah Lee
56 plays
|
|
Lesson 22.8 Subclass InitializersIn this video we show that thte primary purpose of the super function is in the initializer method of the subclass. That is because we cannot guarantee that all of the attributes for the parent class…
From Hannah Lee
79 plays
|
|
Lesson 21.6 Immutable AttributesGetters and setters have another advantage in that they allow us to completely disable to any changes to an attribute. This allows us to separate attributes into mutable and immutable attributes,…
From Hannah Lee
98 plays
|
|
Lesson 21.5 Data EncapsulationIn this previous video we introduced the concept of getters and setters. But how do we force the user to use these when the attribute is so much simpler. In this video we talk about the concept of…
From Hannah Lee
108 plays
|
|
Lesson 21.4 Invariant EnforcementWe know how to enforce preconditions, but how do we force invariants for our attributes? As we see in this video, we do it much the same as for preconditions. But that is because we are going to…
From Hannah Lee
115 plays
|