c# - Virtual Method Throw new NotImplementedException(); -
I got class A, one inherited B and the second class C that is from B.
I want to define some methods in my class, but do not implement it, if I declare it as a table, then I have to apply it in my heritage class, and give me this I do not want to apply that method to my class as an example
Is this process correct?
public class A {public virtual string getValue (new {NotImplementedException ()}; } ....}
second class
public class B: A {...}
Third class
public class C: B {public override string getValue () {... // Return to a string}
or I want interface Use?
You can mark the method as an abstract and you can also create a binary form, so only To implement C getValue
You can definitely use an interface instead, it depends on what you're actually doing.
{New NotSupportedException (); }
Comments
Post a Comment