SE450: Template Method: Template Method is NOT inheritance [28/35] Previous pageContentsNext page

Inheritance:

class B {
  void f() { ... }
}
class D extends B {
  void g() { ... f() ... }
}

Template Method:

class B {
  void f() { ... g() ... }
  abstract void g();
}
class D extends B {
  void g() { ... }
}

Previous pageContentsNext page