From 95c1144ca2323d6904f084d7e6e33cf4de54e69a Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 16 Jan 2025 16:30:03 +0100 Subject: [PATCH] Add a demonstration for the `super` keyword --- restaurant/src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/restaurant/src/lib.rs b/restaurant/src/lib.rs index 59847e9..ddaeb38 100644 --- a/restaurant/src/lib.rs +++ b/restaurant/src/lib.rs @@ -1,3 +1,5 @@ +fn deliver_order() {} + mod front_of_house { pub mod hosting { pub fn add_to_waitlist() {} @@ -14,6 +16,15 @@ mod front_of_house { } } +mod back_of_house { + fn fix_incorrect_order() { + cook_order(); + super::deliver_order(); + } + + fn cook_order() {} +} + pub fn eat_at_restaurant() { // Absolute path crate::front_of_house::hosting::add_to_waitlist();