CSE 115 Lecture Notes - Lecture 31: Subtyping

37 views3 pages

Document Summary

How many interfaces can a (user-defined) class implement: none, exactly one, one or more, zero or more, no more than eight (23) answer: d. zero or more. Same type implications as for interfaces: instance of subclass belongs to subclass type and superclass type inheritance: non-private members of superclass can be accessed via subclass object. When a class is instantiated, memory is reserved for the whole object, including parts contributed by ancestor classes. Memory for new b() public class a { private int _x; public a(int x) { _x = x; public class b { private double _y; public b(double y) { _y = y; public class a { private int _x; public a(int x) { _x = x; public class b extends a { private double _y; private boolean _z; public b() { this(1. 0, false); public b(double d, boolean b) { super(5);

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