FlashKeepers

Python · Python · College and University

Python: Object-Oriented Programming

Python classes, inheritance, and object-oriented concepts explained with a short example each.

About this set

40 basic cards for Python Python. Set 3 of 11 in Python. It opens with "What is a class in Python?" and "How does an object relate to a class?". More College and University decks are listed below.

40 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What is a class in Python?
Show answerA blueprint or template for creating objects with shared attributes and methods
How does an object relate to a class?
Show answerAn object is a concrete instance of a class containing actual data
What Python keyword is used to define a class?
Show answerclass
What is the __init__ method in a class?
Show answerThe constructor that is automatically called when a new instance is created
What does the self parameter represent in a method?
Show answerA reference to the current instance of the class
What is an instance attribute?
Show answerAn attribute that belongs to a single object and can differ across instances
What is a class attribute?
Show answerAn attribute defined in the class body that is shared by all instances
What is inheritance in object-oriented programming?
Show answerA mechanism where a child class acquires the attributes and methods of a parent class
How do you create a child class that inherits from a parent?
Show answerclass ChildClass(ParentClass):
What is method overriding?
Show answerRedefining a method from the parent class in the child class with different behavior
What does super() do?
Show answerCalls a method in the parent class from within the child class
What is encapsulation in OOP?
Show answerBundling data and methods together and hiding internal implementation details
What does a single underscore prefix on an attribute mean?
Show answerBy convention, it signals the attribute is intended to be private or internal
What does a double underscore prefix on an attribute do?
Show answerIt triggers name mangling to make the attribute harder to access from outside the class
What does the @property decorator allow?
Show answerDefining a method that can be accessed and used like an attribute with dot notation

25 more cards in the app

Study this set free