Lecture 14
11
How inheritance works                  (Hline.java main)
•64  Line hline = new HLine( 10, ‘x’);
•Variable hline declared of type Line can have a value that’s a reference to an instance of some child of Line
•Line foo = new Line() not legal (since Line is abstract)
•
•70 hline.setPaintChar(‘*’);
•Send setPaintChar message to Line hline,                          which happens to be an HLine
–Java looks for setPaintChar method in class Hline
–Not there! So looks in parent class Line
–Found it! So search stops