can't call super from method but I need to??

C

caultonpos

See below, how can I call animals growl while within a method of my
interface (I need that - cant get rid of it).

public class animal {
public void growl() {
System.out.println("growl");
}
}

public class dog extends animal {


public void growl() {
IDefaultCall default = new IDefaultCall () {

public void execute() {
// I can do it this as super. points to IDefaultCell !
super.growl();
}
};
call (default);
}

}
 
D

Daniel Pitts

See below, how can I call animals growl while within a method of my
interface (I need that - cant get rid of it).

public class animal {
public void growl() {
System.out.println("growl");
}
}

public class dog extends animal {


public void growl() {
IDefaultCall default = new IDefaultCall () {

public void execute() {
// I can do it this as super. points to IDefaultCell !
super.growl();
}
};
call (default);
}

}
First, class names should be UpperCase.

I think the syntax you're looking for is something like dog.super.growl();
 
C

caultonpos

First, class names should be UpperCase.

I think the syntax you're looking for is something like dog.super.growl();

Yes I just typed here in lowercase.

Even if it looks like a static method call that syntax works, learn
something every day.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top