Row by row:
namespace StudyExample1
{
class Program
{
class A
{
static int Fa = 2;
protected A(int a) { Fa += a; }
protected A() { Fa++; }
protected int f
{
get { return Fa++; }
set { Fa += value; }
}
}
class B : A
{
int Fb = 6;
public B(int a) { Fb-=2*a; }
public B(int a, int b)
{
Fb += b+a;
}
public new int f
{
get { return Fb; }
set { Fb += value; }
}
public override string ToString()
{
base.f=-1;
return String.Format("{0}", base.f - f);
}
}
static void Main(string[] args)
{
B obj1 = new B(2), obj2 = new B(2, 1);
obj1.f = 1;
obj2.f = 2;
Console.Write(obj1);
Console.Write(obj2);
Console.Write(obj2);
Console.Write(obj1);
}
}
}