Given the following code, why is "NextKey" not available to methods in MyClass2?
I always thought that when you extend a class, all of the member methods and properties would be part of the second class--otherwise, what's the point of extending an existing class?
Code:
class MyClass1{
public int getNextKey(){
return _NextKey;
}
public void setNextKey(int val){
_NextKey = val;
}
MyClass1(){
}
private int _NextKey;
}
class MyClass2 extends MyClass1{
MyClass2(){
super();
}
public void doSomething(value){
_NextKey = value;
}
}