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



On Dec 30, 6:32 pm, Daniel Pitts
<newsgroup.spamfil...@xxxxxxxxxxxxxxxxxxx> wrote:
caulton...@xxxxxxxxx wrote:
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();

--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>- Hide quoted text -

- Show quoted text -

Yes I just typed here in lowercase.

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



Relevant Pages

  • Re: two questions
    ... syntax for method declarations when there are name collisions due to ... there is no special syntax (I might be thinking of chaining inheritance ... Daniel Pitts' Tech Blog: - Hide quoted text - ...
    (comp.lang.java.programmer)
  • Re: Creating a "toy" OO/AO language...
    ... Daniel Pitts writes: ... although I'm not sure I like the syntax. ... S P Engineering, Inc. | Large scale, mission-critical, distributed OO ... | systems design and implementation. ...
    (comp.object)
  • Re: classes/packages..
    ... maya wrote: ...     location: class test.helloworld ... Daniel Pitts wrote: ... the message said that it couldn't find the 'helper' ...
    (comp.lang.java.help)