20-apr14

20-apr14 - COMP 110 Inheritance Tabitha Peck M.S MWF 3-3:50...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
1 COMP 110 Inheritance Tabitha Peck M.S. April 14, 2008 MWF 3-3:50 pm Philips 367
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 Announcements
Background image of page 2
3 Questions?
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 Today in COMP 110 Inheritance
Background image of page 4
5 Inheritance Define a general class Later… define specialized classes Specialized class inherits properties from general class Instance variables Methods
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
6 Shapes Shape Rectangle Shape Shape Rectangle Square
Background image of page 6
7 Base Class Shape Color xLocation yLocation An existing class  that a derived  class is built upon
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
8 Derived Class Shape Color xLocation yLocation Derived class inherits  variables and methods  from base class Rectangle length width
Background image of page 8
9 Shape Color xLocation yLocation setShapeColor translateShape Rectangle length width drawShape scaleShape Rectangle r = new Rectangle r.setShapeColor(Color.GREEN)
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
10 Derived Class Rectangle length width drawShape scaleShape calcArea calcPerim Square setSize scaleShape
Background image of page 10
11 extends public class Derived_Class_Name extends Base_Class_Name { Declaration_of_Added_Instance_Variables Definitions_of_Added_And_Overridden_Methods } public class Rectangle extends Shape { }
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 19

20-apr14 - COMP 110 Inheritance Tabitha Peck M.S MWF 3-3:50...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online