Lesson 13 Flashcards
Object Oriented Programming OOP
OOP is a programming concept developed in the 1960/ and broadly supported in major languages starting in the 1980s
Based on the idea of defining a customized software object that has properties and functionality
Classes
A class is the description or definition of the attributes and methods that an object of that class has. We use the class keyword to begin a class
__init__
Init is a function that initializes an object attributes.
It is automatically called when an instance is created
Its first argument is always self but it contains additional arguments
Self
Is used to access an instance’s attributes or methods.
Without the use of self an attribute could be shared by all instances of a class
Inheritance
Inheritance allows us to create classes (called child or derived classes) that inherit the attributes and methods from another class (called the parent or base)
Polymorphism
The same method name is used in multiple classes. For example len()
- a childs method overrides the parents in the case of a name conflict. When using a method, the one that is called is the one that is defined within the instances class.
Operator overloading
Operator overloading refers to overriding the behavior of standard operators, such as plus or minus.