Computer Science 1026A/B Chapter Notes - Chapter 10: Init, Instance Variable, Dont

53 views3 pages
terubarenuka and 39895 others unlocked
COMPSCI 1026A/B Full Course Notes
26
COMPSCI 1026A/B Full Course Notes
Verified Note
26 documents

Document Summary

Computer science fundamentals i lecture notes - cs1026. Lecture 10 subclass inherits data & behaviour from a superclass. Object-oriented design uses inheritance as a relationship between a more general class (super class) and a more specialized class (subclass) substitution principle: you can always use a subclass object when a superclass object is expected. Group classes into inheritance hierarchy to share common code among the classes. When using a superclass: from file import classname. Don"t have subclasses if they are too similar all 3 cars get to point b from point a the same way. Single class vs inheritance single class for variation in values inheritance for variation in behaviour. When are classes beneficial? if they have behaviour if they have attributes. The cosmic superclass: object every class declared automatically extends the class object. Defines general methods such as __repr_: returns string representation for each object, can override in subclasses for use in debugging.

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