1. Học hỏi
  2. /
  3. Khoa Học
  4. /
  5. Intermediate Object-Oriented Programming in Python

Connected

Bài tập

Creating an Abstract Base Class

Abstract base classes are a great way to create a "blueprint" for a number of classes that are quite similar. In this example, you'll create an abstract base class called Company with one abstract and one concrete method. Good luck!

Hướng dẫn

100 XP
  • From the abc module, import ABC and abstractmethod.
  • Create an abstract base class called Company that inherits from ABC.
  • Define an abstract method called create_budget(), but use pass to implement no logic.
  • Create a concrete method with name hire_employee().