#118 Unable to call inherited methods

open
nobody
General (151)
5
2003-04-03
2003-04-03
Anonymous
No

Bean shell version 1.2.7
Here is the sample program that highlights the
problem...

import java.util.*;
abstract class AbstractA {
abstract public String getValue();
public void print() {
System.out.println(getValue());
}
}

public class A extends AbstractA {
public String getValue() {
return ("Class A");
}

public static void main (String[] args) {
/* This works if called from java. If I try to put
following two lines in bsh
* I get error like
* // Error: Error in method invocation:
* No args method print() not found in class'A' :
at Line: 2 : in file: <unknown file> : a .print ( )
*/
A a = new A();
a.print();
}
}

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks