ITEC 2610 Lecture Notes - Lecture 9: James Gosling, Instance Variable, Reserved Word

117 views11 pages

Document Summary

Inheritance: the relationship between a more general class (superclass) and a more specialized class (subclass). The subclass inherits data and behavior from the superclass. Cars share the common traits of all vehicles. Example: the ability to transport people from one place to another. The class car inherits from the class vehicle. Inheritance lets you reuse code instead of duplicating it. Two types of reuse: a subclass inherits the methods of the superclass, because a car is a special kind of vehicle, we can use a car object in algorithms that manipulate vehicle objects. You can always use a subclass object when a superclass object is expected. A method that processes vehicle objects can handle any kind of vehicle. There are different kinds of questions: a question can display its text, and it can check whether a given response is a correct answer. You can form subclasses of the question class. section_1/question. java. 2 a question with a text and an answer.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents