There are two classes:
class A
{
protected IntPtr i;
public A(A copy)
{
this.i = SomeStaticClass.Copy(copy.i);
}
protected A(IntPtr ds)
{
this.i = ds;
}
}
class B : A
{
public B(A init)
{
SomeStaticClass.doSomethingWith(init.i); //Cant access this field.
}
public void AnotherMethod(A asd)
{
SomeStaticClass.doSomethingWith(init.i); //Cant access this field again.
}
}
Field "i" in A class may controll the unmanaged code, so it's should'nt be public.
And I dont wanna make a copy of A (whinch gonna call some unmanaged code to copy i field, whinch is taking some time), this constructor of B is just converting A to B.
Why do objects of class B cant access objectOfA.i field?
Is there any way to fix that problem?