I'm having a slight problem with CPPDepend's ability to detect virtual function usage. Consider the following scenario. Two classes, CParentClass and CChildClass, where CChildClass is derived from CParentClass. The CParentClass has a virtual function Test and CChildClass overrides the base class version of Test.
When it comes to usage, for various reasons I want to do something like the following:-
CChildClass * pMyChild = new CChildClass();
CParentClass * pParentClass = (CParentClass*)pMyChild;
int B = pParentClass->Test();
delete pParentClass;
This results in pMyChild's Test function being called, as desired, yet CPPDepend doesn't detect this and claims that the code is never reached. If I add the word "virtual" to the Test function header in CChildClass (in addition to the one already in CParentClass) then CPPDepend claims everything is ok.
Can anyone shed some light on this for me please as it feels wrong that I should have to put virtual in the derived class function as well as the base class function.
A similar issue can be seen with CDialog destructors in derived classes. Without the virtual in the derived class destructor declaration, CPPDepend complains.
Thanks for any help you can give.
Regards
Neil.