Hi All,
The following code Snippet is used in our current project.
When I spoke to the architect I mentioned why don't we just allow the subclasses to override the MethodA() and MethodB() through normal inheritance. His response was that all common code should be in the base class and subclass should just implement their specific needs.
However, we can just call the super.MethodA() etc from the subclasses, but his argument was that developers may not when to call super.MethodA(), that is either in the beginning of the method or end.
The major concern that I had was that the BaseClass and SubClass will have a dependency. For example if a subclass does not require the specific behaviour of the baseclass it must put the smarts in to resolve this issue. Or vice versa the base class will have to put the smarts in.
Is there a
pattern that will guarantee this setup and there won't be any of these dependences.
Thanks in advance,
Shameer