vb.net - Mark Overridden member as obselete -
Say I have such a class structure:
public class student people The Overridi Function SayHello () String and Function Enge Class Public Class Undergraduate Inherits Student and Lieutenant; Obsolete ("marked as expelled 04/11/14"., True)> _ Lok Override Function is a example of Sohlo () string and function and class as
if undergraduate
call SayHello
I would like to call the student
version of the method I thought it would be receiving by applying ObseleteAttribute
, though it is not. Do I have to comment or remove the overriding undergraduate.sahello
method?
obsolete entry
is not the reason for the compiler to ignore the presence of the method . The compiler still compiles the method in the assembly, so if it is called successfully, the version of undergraduate
will still be called. The attribute is only the metadata that describes the compiler method embedded in the assembly. This feature will ideally call consumers by speaking, but it can not stop the method from existing. To emphasize the use of the method's base student
version, you can either create a pass-through method that calls the base method such as:
public class undergraduate inherites student public override function Sohlo () as string mybase. Seyellow () and Function Angle Class
Or, more just, completely method Delete:
Public Class Undergraduate T Inherits student 'is no longer necessary to use the base implementation "public override function Sohelo () string end and as the function and Class
Comments
Post a Comment