multilevel inheritance
i have 3 classe i.e., A,B,C which are in multilevel inheritance.what i need is... i want to access class A variable in class B but that should not be accessed in class C and at the same time class B variable should be accessed in class C.How can i achieve this .Thanks in advance.
Jan MontanoPosted Mar 5, 2009, 1:10 AM
e.g.
public class A
{
protected int protectedInteger = 1;
}
public class B : A
{
protected string protectedString = "Hello World";
private void TestB()
{
int myInteger = protectedInteger;
}
}
public class C : B
{
private void TestC()
{
string myString = protectedString;
// int myInteger = protectedInteger; // this call will result in an error
}
}