M
Mark
I know that you can't have a static virtual property, but is there a
way to simulate the same results?
I have a base class that I want to extend so that you can change a
value and it inherits all of the methods to work with that value.
That's easy enough:
class BaseC {
string val;
public DoSomething() {
//manipulate val
}
}
class Derived : BaseC {
public Derived() {
val = "foo"
}
}
Derived.DoSomething() now manipulates "foo"
Now if I want BaseC to have static methods, that also manipulate
'val', I have to make val static. But when I have multiple derived
classes with static constructors, the static variable is for all of
the derived classes (bad).
I thought I could make static virtual properties that could just be
overloaded in the derived classes to return the correct value, but as
I stated, static virtual is not allowed.
Any Ideas?
Mark
way to simulate the same results?
I have a base class that I want to extend so that you can change a
value and it inherits all of the methods to work with that value.
That's easy enough:
class BaseC {
string val;
public DoSomething() {
//manipulate val
}
}
class Derived : BaseC {
public Derived() {
val = "foo"
}
}
Derived.DoSomething() now manipulates "foo"
Now if I want BaseC to have static methods, that also manipulate
'val', I have to make val static. But when I have multiple derived
classes with static constructors, the static variable is for all of
the derived classes (bad).
I thought I could make static virtual properties that could just be
overloaded in the derived classes to return the correct value, but as
I stated, static virtual is not allowed.
Any Ideas?
Mark