class A
{
protected int i = 13;
}
class B : A
{
int i = 9;
public void fun() {
console.write(i);
}
}
Upon calling method fun()
from class B object , it prints the value 9.
What if i wanted to access the protected i=13
value in fun()
.
When protected attribute have the same name as the derived class private attribute , how to access the protected attribute of the base class within derived class ?
This would be a bad idea anyway. But you may try base.i
.