Lec 16 | MIT 6.00 Introduction to Computer Science and Programming, Fall 2008
Vložit
- čas přidán 18. 08. 2009
- Lecture 16: Encapsulation, inheritance, shadowing
Instructors: Prof. Eric Grimson, Prof. John Guttag
View the complete course at: ocw.mit.edu/6-00F08
License: Creative Commons BY-NC-SA
More information at ocw.mit.edu/terms
More courses at ocw.mit.edu
now on Python 3 you can data hide
I appreciate a lot for this knowledge base electronic lecture.
I love these videos
Making more progress with these few lectures in a shorter time than when I did my degree and bombed in this topic. Had to change courses!
Thank you MIT.
Awesome, this is interesting.
MIT OpenCourseWare, thank you!
Prof. Eric has a great sense of humor. I think he could be an equally amazing stand up comedian!!
For anyone who's been following the assignments, what did you use as the key for your dictionary on the DP part of the last problem set, ps8? My answer matched with the example for W = 30 and it ran fairly fast, but I had to use a tuple of four variables to get a workable key. Anyone have a better solution?
beautiful examples!
python is pretty!
Welcome back Sir . A reminder to old times
@NicolPotent actually its 'nailed that pset'
Can any one discern what it says up arrow above PER box
김윤우 I was confused too at first, but around 8:32 he clarifies it is an "is-a" link, which denotes that per (self) 'is a' Person
Underbar sounds kinda weird
What did he mean by it's not symmetric at 32:04? Why wouldn't it compare first/last names because an UG is an MIT Person that is a Person which has first/last names?
Anna Z i think its because it comparing id num but it doesnt exist
2 years late, but I think he means the inheritance differs by the self or implicit object. ug.__cmp__(per) is calling its compare method on ug, with per as the argument, so the compare that ug is using is inherited from its parent class MITPerson (comparing ids) and it doesn't go all the way back to the cmp method in Person.
Whereas the second example the order is reversed, so the call is per.__cmp__(ug), with per using the compare method accessible to it, directly from Person (checking first name, last name), with ug passed as the argument instead.
👍👍👍👍👍👍👍👍👍
In c# it is so easy because you have public, protected and private. Python's lacking of this is very bad.