- Exercise
Let's solve an exercise in this lesson related to example 2 of the previous lesson.
We'll cover the following
Problem statement #
The class hierarchy in the file was built as we have seen in the previous example, following the famous template method design pattern. The typical implementation of the template method pattern is to use NVI. NVI stands for non-virtual interface, meaning the interface should not be virtual. NVI requires non-virtual inheritance, which is not possible in Java or Python. Click here for more details.
Refactor it with the help of override
and final
.
Get hands-on with 1400+ tech skills courses.