Inheritance (Discussion 4) (Kế thừa trong Java) - Christine Zhou
Tài liệu thảo luận về kế thừa trong Java, bao gồm các khái niệm extends, interface, abstract class, static/dynamic types và bài tập ví dụ.
プレビューを生成中...
Discussion 4: Inheritance Christine Zhou Agenda Announcements Review: Inheritance Problem 1 Review: More Inheritance Problem 2 Review: Static/Dynamic Types Problem 3 Announcements Office hours was crowded… Make sure to get started early and go to office hours earlier for help! Piazza questions: give us more information! What is the error that is being outputted? What have you tried to fix the error? Git-bug Proj0 due Monday 11:59PM See late policy on the course website HW2 due this Friday 11:59PM, go to OH early!! Guerrilla section planned for this weekend Saturday, 1-3PM in the labs Midterm next week on Wednesday 9/27 8-10PM Discussion survey: tinyurl.com/czdisc4 Review: Inheritance public class Fish { String name; public Fish(String name) {...} public class Goldfish { String name; public Goldfish(String name) {...} Public void eat() {...} public void blink() {...} public void eat() { print(“bloop”); ... } } public void blink() {...} } Review: Inheritance extends (can extend only one class) Inherits all instance variables and methods Constructor is not inherited, but there will be an implicit call to super( ) in the beginning of the subclass’s constructor (need to make the Fish before making the Goldfish) constructor() { this.hello = 10; constructor() { super(); SAME! } this.hello = 10; } constructor() { this.hello = 10; DIFFERENT! } this.hello = 10; constructor() { super(10); Review: Inheritance public class Fish { String name; public Fish(String name) {...} Public void eat() {...} public void blink() {...} public class Goldfish extends Fish { public Goldfish(String name) { super(name); // need to have this! ... } public void eat() { print(“bloop”); super.eat(); } } } 1 Creating Cats Given the Animal class, fill in the definition of the Cat class so that it makes a "Meow!" noise when greet() is called. Assume this noise is all caps for kittens (less than 2 years old). How similar are Cats with Animals? How do we t
… Tải file gốc để đọc toàn bộ tài liệu.
- ドキュメント名
- Inheritance (Discussion 4) (Kế thừa trong Java) - Christine Zhou
- 学校 / コース
- University of California, Berkeley · Lập trình Java
- 著者(ドキュメント内)
- Christine Zhou
- 内容
- Tài liệu về kế thừa trong lập trình hướng đối tượng
- 目次
- Announcements
- Review: Inheritance
- Review: More Inheritance
- Review: Static/Dynamic Types
- Doc.pages
- 19 ページ
- アップロード者
- Giang Le
よくある質問
Tài liệu này có miễn phí không?
Có. “Inheritance (Discussion 4) (Kế thừa trong Java) - Christine Zhou” miễn phí — bạn chỉ cần đăng nhập rồi bấm Tải xuống để lấy file gốc.
Tài liệu dài bao nhiêu trang?
Tài liệu gồm 19 trang, thuộc môn Lập trình Java. Bạn có thể xem trước online trước khi tải.
Tôi có thể xem trước trước khi tải không?
Có. Bạn xem trước tài liệu ngay trên trang này bằng trình đọc online, rồi quyết định tải về.

コメント (0)
まだコメントはありません。最初のコメントを書きましょう!