c# - How do I use an overridden property value in a higher class? -


I am using IOC to define some behavior in my heritage class. I have a property

  Protected Virtual Boole Utility {Receive {return true; }}  

In my top-level category

I have my legacy class

  using protected override bull {get {details {details are false; }}  

I am using the property in my top level class, and it is using top-level values. Is there a way to do that uses inherited values? I thought it was supposed to do the same thing.

Code example:

  Using the system; Public Class Program {Public Fixed Zero Main () {BB = New B (); B.PrintThing (); // I want to print it for B} public class A {protected virtual bool} {get {return true; }} Public Zero Printing () {Console.WriteLine (this.Enabled.ToString ()); }} Public Segment B: A {Safe Override Bull Enabled {get {return false; }}}}  

you can do something like this :

You do not know anything from the implementation of AKB, so you have to instantiate the object of B to use your orndridine property.

Modified version of your Bela:

  Public class program {Public stable zero} (A = new A); A.PrintThing (); A new A = new B (); NewA.PrintThing (); } Public class A {Secure Virtual Boole enabled {get {return true; }} Public Zero Printing () {Console.WriteLine (this.Enabled.ToString ()); }} Public Segment B: A {Safe Override Bull Enabled {get {return false; }}}}  

Comments