Lecture 19: Inheritance

preview_player
Показать описание
MIT 6.100L Introduction to CS and Programming using Python, Fall 2022
Instructor: Ana Bell

This lecture describes how to add layers of complexity through hierarchies and child classes which inherit data and methods from parent classes. Like functions, classes are a mechanism for decomposition and abstraction in programming.

License: Creative Commons BY-NC-SA

Рекомендации по теме
Комментарии
Автор

I have read many novels in my life, but your course seems to be the best of all Thanks

mohamedbelazreg
Автор

class Rabbit is an object, the "shared across all instances" is misleading, class Rabbit exists and all objects within can be manipulated, even before creating any object of type Rabbit.
e.g. first session created table with 4 rabbits, second session looks up largest rid in table, and sets tag to that value+1, second session starts with correct value.
in first session the user could get the choice "start numbering at 0 or 1" and update tag if needed (add setter for that)

jyvben
Автор

It is very interesting that we cannot use a list as the name for a dictionary because a list is mutable, but we can use a class as names. I feel like a class should be considered mutable because for example, we can change the attribute of the class. So using a class as name of a dictionary seem to be making a mutable object as the name of a dictionary, setting up a conterexample for what it is said a couple lectures ago.

voitikfamily
Автор

The cat on the top is sooo fucking cute ❤️😭

felixiyy
Автор

Can two classes have subclasses of the same name?

jpan
Автор

Hi, I like the way the personification orbs of your chromosome pocket calls to my Chromosome Stick Interstellar Gravity Cap Spaceship.
No one understands it operates on inner expansion threw outer compression of space within a G_Spot of flow in linearity.
The Quantum Mechanics of Astrophysics found in the Molecular Structure of Organic Chemistry.
The Bonding Order of Atomic Orbitals found in chain Reaction Formula.
If that statement makes me unreasistably handsome, please laugh out loud where you are.

CharteriousLiberax