Build a TimestampMixin
Advanced · Write the code · from Python Multiple Inheritance and MRO: How It Actually Works
From the lesson: Python Multiple Inheritance and MRO: How It Actually Works
Think about how you inherit traits from your parents. You might have your mom's eyes and your dad's sense of humor. You didn't pick one parent - you got traits from both.
Read the lessonCreate a TimestampMixin class with a method created_info() that returns the string 'Created by <class_name>' where <class_name> is the actual class name. Then create a Document class that inherits from TimestampMixin and has an __init__ that takes a title. Print the title and the created_info().
Expected output:
My Report
Created by Document# Create TimestampMixin and Document
More Multiple Inheritance exercises
- Create a Hybrid ClassIntermediate
- Predict the MROAdvanced
- Fix the Cooperative __init__Advanced
- Predict the super() ChainAdvanced
All Python exercises · 50 practice problems · Object-Oriented Programming quiz