Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Python INHERITANCE in 6 minutes! ๐Ÿ‘จโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ
Play lesson

Python tutorial for beginners ๐Ÿ - Python INHERITANCE in 6 minutes! ๐Ÿ‘จโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ

4.0 (0)
8 learners

What you'll learn

This course includes

  • 14.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

# Inheritance = Inherit attributes and methods from another class # Helps with code reusability and extensibility # class Child(Parent) class Animal: def __init__(self, name): self.name = name self.is_alive = True def eat(self): print(f"{self.name} is eating") def sleep(self): print(f"{self.name} is asleep") class Dog(Animal): def speak(self): print("WOOF!") class Cat(Animal): def speak(self): print("MEOW!") class Mouse(Animal): def speak(self): print("SQUEEK!") dog = Dog("Scooby") cat = Cat("Garfield") mouse = Mouse("Mickey")

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere