I have a structure similar to this:
class OuterClass{
AnimatorListener sth;
public OuterClass(){
sth = new InnerClass();
}
public class InnerClass implements AnimatorListener{
public InnerClass(){}
public void doSomething(){}
//assuming animator listener methods implemented
}
public void tryingToDoSomething(){
sth.doSomething(); //I cannot use this, simply it is not seen by eclipse.
}
}
Why cant I call doSomething()
method of sth
object while I am tryingToDoSomething()
?
change your constructer syntax. It is wrong
public OuterClass{
sth = new InnerClass();
}
change this to
public OuterClass(){
sth = new InnerClass();
}
Your object sth
belongs to class AnimatorListener
but it should belong to InnerClass
. Hope this helps, happy coding.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.