diff --git a/behavioral/template-method/README.md b/behavioral/template-method/README.md index 8551eed..03da7dd 100644 --- a/behavioral/template-method/README.md +++ b/behavioral/template-method/README.md @@ -25,6 +25,7 @@ Same client code can work with different concrete implementations: TemplateMethod says: I am doing the bulk of the work ConcreteStruct2 says: Implemented Operation1 TemplateMethod says: But I let subclasses override some operations +ConcreteClass2 says: Overridden Hook1 ConcreteStruct2 says: Implemented Operation2 TemplateMethod says: But I am doing the bulk of the work anyway ``` diff --git a/behavioral/template-method/main.rs b/behavioral/template-method/main.rs index 81e4d87..f073632 100644 --- a/behavioral/template-method/main.rs +++ b/behavioral/template-method/main.rs @@ -50,6 +50,10 @@ impl TemplateMethod for ConcreteStruct2 { fn required_operations2(&self) { println!("ConcreteStruct2 says: Implemented Operation2") } + + fn hook1(&self) { + println!("ConcreteClass2 says: Overridden Hook1") + } } fn client_code(concrete: impl TemplateMethod) {