scala - How to access a field of a super-class which is implemented in Java which also has an equal-named method? -
i want extend class implemented in java. here example:
public interface javainterface { /** computes foo. */ public string foo(); } public class thisisjava implements javainterface { protected string foo = "foo"; /** returns value of property foo. */ public string foo() { return foo; } } but how disambiguate between field , method foo when extend class in scala?
class thisisscala extends thisisjava { def foobar = super.foo + "/bar" // doesn't compile }
you cannot access foo field because it's private. can access super.foo().
update: think have problem because in scala there no distinction between fields , methods, option option have adapter thisisjava, , extend adapter in scala.
Comments
Post a Comment