I have something like the following situation below:
class Base
{
public static int x;
public int myMethod()
{
x += 5;
return x;
}
}
class DerivedA : Base
{
}
class DerivedB : Base
{
}
I am trying to set this up so that each derived class has its own static instance of x if I do something like this:
DerivedA.x = 5;
DerivedB.x = 10;
then at startup:
DerivedA.myMethod();
DerivedB.myMethod();
Can I do something like this? How can I customize derived classes to achieve this? Thanks guys.
EDIT: , , , . , , . , , .
. , - , . .
, , -.. !