I have a normal class called BaseView
with a virtual method DisplayView
. This method calls GetHeader
and GetBody
virtual methods to get contents for the page. I would then create a class that inherits from BaseView
and override the methods that needs to display content differently than the way the base class does it.
My issue is that, although this works great, when running a code analysis I'm warned not to call the virtual functions directly.
Should I create another class layer on top of the base class that override the virtual functions and only inherit from that?
What are the disadvantages of using the virtual methods directly?
EDIT: the warning is:
CA2214 : Microsoft.Usage : xxx contains a call chain that results in a call to a virtual method defined by the class. Review the following call stack for unintended consequences