User Tools

Site Tools


virtual_methods

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

virtual_methods [2018/06/07 09:23]
wolfgangriedmann created
virtual_methods [2018/06/07 09:25]
wolfgangriedmann
Line 4: Line 4:
 <​code>​Warning XS0108 '​MySon.MyMethod()'​ hides inherited member '​MyFather.MyMethod()'​. Use the new keyword if hiding was intended. </​code>​ <​code>​Warning XS0108 '​MySon.MyMethod()'​ hides inherited member '​MyFather.MyMethod()'​. Use the new keyword if hiding was intended. </​code>​
 please check the compiler option ''/​VO3 Virtual Instance Methods''​ or add the keyword ''​virtual''​ to your methods. 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|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 09:25 by wolfgangriedmann