“Python Super” Kod odpowiedzi

Python Super

# It's kinda hard to explain this just by code.
# So I'll provide a link to a pretty good explanation of it.
https://www.pythonforbeginners.com/super/working-python-super-function
Random boi

Python Super

class Square(Rectangle):
    def __init__(self, length):
        super().__init__(length, length)
rebellion

Python Super

class Animal(object):
  def __init__(self, animal_type):
    print('Animal Type:', animal_type)
    
class Mammal(Animal):
  def __init__(self):

    # call superclass
    super().__init__('Mammal')
    print('Mammals give birth directly')
    
dog = Mammal()

# Output: Animal Type: Mammal
#         Mammals give birth directly
Boody Mohamed

Odpowiedzi podobne do “Python Super”

Pytania podobne do “Python Super”

Więcej pokrewnych odpowiedzi na “Python Super” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu