I extra said derived classes and NOT children classes.
I have a base class and many derived classes. One derived class should call a method on the base class which again is calling a method on each derived class.
How is that possible? What design pattern should I go for implemention a communication
“channel” between my Controllers driving the UI using MVVM design pattern? I know of mediator
pattern but do not like it much as it blurs the borders of an architecture.
It’s not really a design pattern, but really an understanding of virtual method calls. Let’s say I have something:
And I have a derived class:
In the above example, any call to
DoFooon the base class makes a virtual call to theDoFooInternalmethod of the derived class. I could also define myDoFooInternalas virtual, if I wanted to provide a baseline implementation:In the case of your controllers, this would be the same, you can specify some common shared logic in a
ControllerBaseinstance and derive a child controller, e.g.PeopleControllerwhich can despatch method calls to the base class, which can in turn despatch calls back to virtual methods in the derived class…