questions for dynamic binding and signature method in java ab -
matching method signature , binding method implementation 2 sepearate issue ,what's wrong follows code?
container c5 = new jbutton(); object c6 = new jbutton(); c5.add(c6); //----it wrong,why? for me , c5 reference variable contain reference object of jbutton,and jbutton extends class component,so should right why ?
java single-dispatch language. means method signature analysis done @ compile time, not run time.
the type of c6 object. (yes, assign jbutton, declared type of variable still object.) when java looks @ c5 (a container) , methods, doesn't see add() method takes object. flags error.
Comments
Post a Comment