Search for tag: "initializer"
Lesson 27.3 The GameApp ClassIn this video we introduce the GameApp class, which is a class written by your instructor. In the last assignment you will be creating a subclass of the class to run your game. This video highlights…
From Hannah Lee
87 plays
|
|
Lesson 25.5 Custom Error TypesNow that we can raise an error of any type, it is time to make our own error types. In this video we show that this is incredibly simple, and needs almost no code.
From Hannah Lee
65 plays
|
|
Lesson 23.7 Class MethodsOperator overloading is not the only important abstraction tool. In this video we introduce the concept of class methods, which are necessary to add new constructors to a class. These new…
From Hannah Lee
85 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
76 plays
|
|
Lesson 22.6 Method OverridingSubclasses inherit all of the methods of their parent. But suppose you do not want to use the inherited version of a method, but want to define a new one instead? In this video we talk about the…
From Hannah Lee
81 plays
|
|
Zoom Oct. 29. ClassesIn this presentation, we review the class definition. We look at both the syntax (what must be present for the definition to work) and the semantics (how it is processed in Python).Most of this class…
From Hannah Lee
30 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
94 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
111 plays
|
|
Lesson 21.3 Interface ImplementationOnce you have the interface to a class, it is time to start writing code. As we see in this video, the idea is much the same as writing functions. However, attributes – and specifically…
From Hannah Lee
97 plays
|
|
Lesson 21.1 Interface vs ImplementationWhen we implement (or define) a function, we are given a specification and we complete the rest of the body to match the specification. We will do the same thing for classes as well. But as we see in…
From Hannah Lee
162 plays
|
|
Lesson 20.10 Representation MethodsWhen we first introduced objects, we talked about the concept of object representation. But how does Python know how to use this representation. In this video, we see that this is the result of…
From Hannah Lee
79 plays
|
|
Lesson 20.9 Optional ArgumentsUnlike other programming languages, a Python class has only one constructor, If we want to give the user more flexibility when creating objects, we should make certain arguments optional. In this…
From Hannah Lee
91 plays
|
|
Lesson 20.8 The None ValueWe have seen the None value used in several previous videos. But in this video we finally introduce it formally. In particular, we show why it is so commonly used in object initialization.
From Hannah Lee
89 plays
|
|
Lesson 20.7 IntializersIn this video, we introduce the most important method definition in any class: the initializer. The initializer is responsible for creating all the attributes so that the user does not need to worry…
From Hannah Lee
123 plays
|