How can you achieve inheritance in Python?

  • By creating a subclass that inherits from a superclass
  • By defining a superclass variable
  • By importing a superclass module
  • Using the extends keyword
In Python, you achieve inheritance by creating a subclass that inherits from a superclass using the syntax class Subclass(Superclass):. The extends keyword is not used for inheritance in Python.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *