Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting to Properties in derived class from base
Message
From
01/11/2010 13:22:17
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Getting to Properties in derived class from base
Environment versions
Environment:
C# 4.0
Miscellaneous
Thread ID:
01487780
Message ID:
01487780
Views:
99
Hi all,

If I have a base class, and App level class, and several inherited classes but have added a property in the App Level classe, how can I get to it from the base? I have a reference to the class in the base
public class MyBase()
{
     
     public method MyMethod()
     {
          // I  want to access the EnableSomething property of the specific class here
          // There is a reference to the class in a property
          this.RunningClass.  // property not available.  How to get it?
     }
}

public class MyAppLevelBase() : MyBase
{
     //Property added here
     public bool EnableSomething
     {
          get {return this._enableSomething; }
          set {this._enableSomething = value; }
     }
}

// bunch of classes like this one
public class MyClass1() : MyAppLevelBase
{
    public MyClass1()
    {
        this.EnableSomething = true;
     }
}
Timothy Bryan
Next
Reply
Map
View

Click here to load this message in the networking platform