Rec 2 | MIT 6.01SC Introduction to Electrical Engineering and Computer Science I, Spring 2011

Поділитися
Вставка
  • Опубліковано 23 сер 2024
  • Recitation 2: Inheritance
    Instructor: Kendra Pugh
    View the complete course: ocw.mit.edu/6-0...
    License: Creative Commons BY-NC-SA
    More information at ocw.mit.edu/terms
    More courses at ocw.mit.edu

КОМЕНТАРІ • 12

  • @convoludedduded5086
    @convoludedduded5086 Місяць тому +1

    I'm going to use this to fall asleep to. Thank you. Will update soon

  • @omarfaruquejahid8164
    @omarfaruquejahid8164 9 років тому +2

    Thanks a lot

  • @tbtitans21
    @tbtitans21 7 років тому +1

    So when she goes over that any child class will be applied, will the main parent class __init__ be applied if there was __init__in the child class? Or will that be just completely negated?

    • @ItzAnameOk
      @ItzAnameOk 7 років тому +3

      tbtitans21 this is called polymorphism, child objects override any attribute/methods that has the same identifier/name to its parent.
      edit: I just realized that __init__ is a constructor so I dont think it gets pass to other classes (unless python does)

    • @tbtitans21
      @tbtitans21 7 років тому

      Thank you

    • @Sai1ence
      @Sai1ence 3 роки тому +2

      @@tbtitans21 A bit late, but I experimented with a bit of Python code before this video and at least from what I found, an object of a certain class (child-class) will inherit the attributes of its parent-class and methods, unless they're overwritten in the child-class. This means that if there's an __init__ method in both the super-class AND child-class, and you're initializing a child-class object, only the child-class initialization method will run. This is different from C++, where the child-class initialization method will run, THEN the super-class initialization method after it.

    • @tbtitans21
      @tbtitans21 3 роки тому +2

      @@Sai1ence Yes, my understanding has grown considerably since.
      You are correct, and if you wish to call the parent class' __init__ method in addition to the child's then you should call:
      super().__init__(*any_necessary_args)
      in the child's __init__ method

  • @constantegmail1804
    @constantegmail1804 7 років тому +2

    who the fuck is benji

    • @renpnal229
      @renpnal229 7 років тому

      Google Benji the dog.

  • @Er.Sunil.Pedgaonkar
    @Er.Sunil.Pedgaonkar Рік тому

    Why American or Western Engineers don't understand that Electrical Engineering, Electronics Engineering (including Telecom Engineering), Computer Science (including Software Engineering)& Computer Engineering (including Computer Network Engineering) are four different engineering disciplines though some subjects or topics in their degree syllabus curriculum may overlap or common?

    • @nickalexander2505
      @nickalexander2505 9 місяців тому +2

      Because you may as well delve into the respective fields as much as possible to understand where all the data you’re getting is coming from? Surprised you have an issue with trying to expand knowledge to a higher degree by finding similarities between fields and connecting them in numerous methods

    • @Er.Sunil.Pedgaonkar
      @Er.Sunil.Pedgaonkar 9 місяців тому

      @@nickalexander2505 I am not getting what you are saying. I am firm on my opinion. A Civil Engineer is NOT Mechanical Engineer NOR A Mechanical Engineer is Civil Engineer. Electrical Engineering, Electronics&Telecom Engineering & Computer&Network Engineering are three different discipline s. Again, IT&Software Engineering is separate discipline. Computer Science & Computer Engineering are two different faculties. In all those disciplines, some subjects in curricula may be common. Practice or Job as Engineer is totally different from research or PhD work.