AC
AnkiCollab
AnkiCollab
Sign in
Explore Decks
Helpful
Join Discord
Download Add-on
Documentation
Support Us
Notes in
Week 2 - Features of OOP
To Subscribe, use this Key
emma-mirror-illinois-north-seventeen-black
Status
Last Update
Fields
Published
10/15/2024
{{c1::Inheritance}} allows a new class to be created from an existing class, inheriting its attributes and methods.
Published
10/15/2024
In inheritance, the original class is called the {{c1::parent}} class, while the new class is called the {{c2::child}} class.
Published
10/15/2024
The {{c1::init()}} method is used to initialize object attributes when the object is created.
Published
10/15/2024
An object’s {{c1::attributes}} are its variables, and its {{c2::methods}} are its functions.
Published
10/15/2024
A class in Python is defined using the keyword {{c1::class}}, followed by the class name and a colon.
Published
10/15/2024
To override a method in a child class, define the method with the same name as in the {{c1::parent}} class.
Published
10/15/2024
Inheritance promotes {{c1::code reuse}}, allowing you to build on existing code without rewriting everything.
Published
10/15/2024
When a method in the parent class is overridden in the child class, the child class can still access the parent method using the {{c1::super()}} funct…
Published
10/15/2024
In Python, an object is an instance of a {{c1::class}}.
Published
10/15/2024
The keyword {{c1::self}} is used in methods to refer to the object on which the method is being called.
Published
10/15/2024
A {{c1::class variable}} is shared among all instances of a class, whereas an {{c2::instance variable}} is unique to each object.
Published
10/15/2024
A {{c1::mixin}} is a helper class that is included in multiple inheritance to provide additional functionality without being a full parent class.
Published
10/15/2024
{{c1::Multiple inheritance}} allows a class to inherit from more than one parent class in Python.
Published
10/15/2024
Python's method resolution order (MRO) can be viewed using the {{c1::mro()}} method or the {{c2::mro}} attribute.
Published
10/15/2024
The {{c1::@staticmethod}} decorator in Python defines a method that doesn’t access the instance or class.
Published
10/15/2024
A {{c1::class method}} is defined with the {{c2::@classmethod}} decorator and takes cls as its first argument.
Published
10/15/2024
The {{c1::is-a}} relationship in OOP refers to the relationship between a child class and a parent class.
Published
10/15/2024
The {{c1::has-a}} relationship represents composition in OOP, where one class contains an object of another class.
Published
10/15/2024
The {{c1::getters and setters}} are methods used to access and modify private attributes in a class.
Published
10/15/2024
The {{c1::property}} decorator in Python allows you to define methods that are accessed like attributes.
Published
10/15/2024
{{c1::Name mangling}} in Python uses double underscores to obscure attribute names, making them harder to access from outside the class.
Published
10/15/2024
In {{c1::single inheritance}}, a class inherits from only one parent class.
Published
10/15/2024
{{c1::Multilevel inheritance}} involves a chain where a class inherits from another class, which itself is a subclass of a third class.
Published
10/15/2024
In {{c1::hierarchical inheritance}}, multiple child classes inherit from the same parent class.
Published
10/15/2024
{{c1::Polymorphism}} in Python allows the same method to be defined in multiple classes, but behave differently depending on the class of the object t…
Published
10/15/2024
{{c1::Encapsulation}} is the concept of bundling data and methods within a class and restricting access to some of the object's components.
Published
10/15/2024
{{c1::Private attributes}} in Python can be made harder to access by prefixing them with double underscores.
Published
10/15/2024
{{c1::The self parameter}} must always be the first parameter in an instance method.
Published
10/15/2024
A {{c1::child class}} can inherit everything from its parent class, but it can also define additional attributes and methods.
Published
10/15/2024
When overriding the {{c1::init()}} method in a child class, you should call the parent’s init() method using {{c2::super()}}.
Published
10/15/2024
A {{c1::method override}} occurs when a child class provides a new implementation for a method that exists in the parent class.
Published
10/15/2024
{{c1::Multiple inheritance}} can sometimes lead to method resolution issues if different parents have methods with the same name.
Published
10/15/2024
The {{c1::super()}} function is used to access methods or attributes from the parent class in a multiple inheritance setup.
Published
10/15/2024
{{c1::Instance attributes}} are unique to each object, while {{c2::class attributes}} are shared across all instances of a class.
Published
10/15/2024
In {{c1::composition}}, a class is made up of one or more objects of other classes, representing a “has-a” relationship.
Published
10/15/2024
A {{c1::getter}} is a method that retrieves the value of an attribute, while a {{c2::setter}} is a method that updates the value of an attribute.
Published
10/15/2024
In Python, you can create a {{c1::property}} by using the {{c2::@property}} decorator above a method, allowing you to access the method like an attrib…
Published
10/15/2024
{{c1::Data encapsulation}} is one of the main advantages of using getters and setters.
Published
10/15/2024
Python’s {{c1::duck typing}} allows an object to be used based on whether it implements certain methods, regardless of its actual type.
Published
10/15/2024
A {{c1::static method}} in Python does not depend on any instance or class data and is defined using the {{c2::@staticmethod}} decorator.
Published
10/15/2024
{{c1::Polymorphism}} refers to the ability of different objects to respond to the same method call in their own way.
Published
10/15/2024
{{c1::Method resolution order (MRO)}} defines the order in which Python looks for methods in a class hierarchy when multiple inheritance is involved.
Published
10/15/2024
{{c1::Hierarchical inheritance}} involves multiple classes inheriting from a single parent class.
Published
10/15/2024
In {{c1::multilevel inheritance}}, a class can inherit from another class, which in turn inherits from a third class.
Published
10/15/2024
{{c1::Single inheritance}} refers to a class inheriting from only one parent class.
Published
10/15/2024
{{c1::Polymorphism}} in Python allows objects of different classes to be treated as instances of the same class if they share the same method names.
Published
10/15/2024
{{c1::Name mangling}} changes the name of a variable in Python by adding the class name in front, preventing access from outside the class.
Published
10/15/2024
The {{c1::mro}} attribute stores the method resolution order of a class in Python.
Published
10/15/2024
When a child class does not define a method, Python looks for that method in the {{c1::parent class}} using the method resolution order.
Published
10/15/2024
The {{c1::isinstance()}} function is used to check whether an object is an instance of a class or a subclass thereof.
Published
10/15/2024
The {{c1::issubclass()}} function checks if a class is a subclass of another class.
Published
10/15/2024
{{c1::Method overriding}} allows a child class to modify or extend the behavior of a method inherited from the parent class.
Published
10/15/2024
{{c1::The isinstance()}} function returns true if an object is an instance of a specified class or its subclasses.
Published
10/15/2024
A {{c1::mixin class}} is used to add additional functionality to a class without being part of the main class hierarchy.
Published
10/15/2024
In OOP, {{c1::composition}} is a technique where one class contains objects of another class, instead of inheriting from it.
Published
10/15/2024
{{c1::The super()}} function in Python is used to call a method from the parent class.
Published
10/15/2024
An {{c1::abstract class}} cannot be instantiated and usually contains one or more abstract methods that must be implemented by any subclasses.
Status
Last Update
Fields