From bac5abb664d1c4c4ca9b177411222b2b6e1c454c Mon Sep 17 00:00:00 2001 From: Donald Calloway Date: Wed, 24 Sep 2025 09:22:20 -0700 Subject: [PATCH] Demo of MRO resolution with multiple inheritance --- mro_resolution_example.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 mro_resolution_example.py diff --git a/mro_resolution_example.py b/mro_resolution_example.py new file mode 100644 index 0000000..4a2b1d1 --- /dev/null +++ b/mro_resolution_example.py @@ -0,0 +1,20 @@ +# Example to demonstrate Method Resolution Order (MRO) in Python + +class A: + def greet(self): + print("Hello from A") + +class B(A): + def greet(self): + print("Hello from B") + +class C(A): + def greet(self): + print("Hello from C") + +class D(C, B): + pass + +d = D() +d.greet() # Hello from C (based on MRO) +