[jsyn] overridden attribute not returned

jsyn at music.columbia.edu jsyn at music.columbia.edu
Fri Dec 17 10:13:37 EST 2004


Andrew,

The method getAttrib() IS in your BaseClass so it returns the BaseClass attrib.
Redefine getAttrib() if you want to override the behaviour.

Paul.





On Friday 17 December 2004 2:09 pm, jsyn at music.columbia.edu wrote:
> Why does my example not return the overridden attribute? It must be
> obvious. "Run" prints out "base_attrib".
>
> Regards,
> Andrew McKenzie
>
> public abstract class BaseClass {
> 	protected String attrib = "base_attrib";
> 	public String getAttrib() {
> 		return attrib;
> 	}
> }
>
> public class SubClass extends BaseClass {
> 	private String attrib = "sub_attrib";
> }
>
> public class Run {
> 	public static void main(String[] args) {
> 		SubClass subclass = new SubClass();
> 		System.out.println(subclass.getAttrib());
> 	}
> }
>
>
> _______________________________________________
> JSyn mailing list
> JSyn at music.columbia.edu
> http://music.columbia.edu/mailman/listinfo/jsyn




More information about the JSyn mailing list