1/18
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Object-Oriented Programming (OOP)
A method of structuring a program by bundling related properties and behaviors into individual objects.
Class
A 'blueprint' for creating objects.
Instance
An object that belongs to a class.
__init__() Method
Executed when class is initiated; used to assign values to the properties of an object or other operations needed in the creation of an object.
self Parameter
Reference to the current instance of the class; used to access the variables that belong to the class.
Modify Object Properties
Changing the value of an object's property.
Delete Object Properties
Using the del keyword to remove a property from an object.
Methods
Functions that belong to the object.
Function
Doesn't need any object and is independent.
Method vs Function
A method is a function linked with an object, while a function can be called directly by its name.
Creating Objects
The process of instantiating a class to create an object.
Deleting Objects
The process of removing an object from memory.
Properties of an Object
Attributes that hold data associated with an object.
Behaviors of an Object
Operations that an object can perform.
Example of an Object
An object could represent a person with properties like a name, age, and address and behaviors such as walking, talking, breathing, and running.
Email Object Example
An object could represent an email with properties like a recipient list, subject, and body and behaviors like adding attachments and sending.
Syntax for Deleting Property
del
First Parameter of Class Function
The self parameter, which can use any other name.
Accessing Class Variables
Using the self parameter to bind the attributes with the given arguments.