User Tools

Site Tools


virtual_methods

All VO methods are virtual

If you receive the warning

Warning XS0108 'MySon.MyMethod()' hides inherited member 'MyFather.MyMethod()'. Use the new keyword if hiding was intended. 

please check the compiler option /VO3 Virtual Instance Methods or add the keyword virtual to your methods.

The explanation by a member of the development team is the following:

About the second one, by default METHODs in .Net are not VIRTUAL, meaning that you cannot override a method of a base class by redefining it in a child class, like we do in VO, this instead creates a completely new method, from the CLR's point of view. In order to make a (base) method overrideable, you must explicitly mark it with the VIRTUAL keyword. Or, you van simply enable the “All instance methods virtual” project option, which tells the compiler to make all methods VIRTUAL by default, for compatibility with VO. Both ways should get rid of the warning (which in this case it is important to resolve it, do not simply disable it). Source: https://www.xsharp.info/kunena/public-product/697-conversion-or-application-of-well-known-vo-libraries-to-x?limitstart=0

virtual_methods.txt · Last modified: 2018/06/07 07:25 by wolfgangriedmann