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
AI 摘要
- 文档名称
- 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
- 页数
- 19 页
- 上传者
- Uni24h
常见问题
此文档免费吗?
是的。“Inheritance (Discussion 4) (Kế thừa trong Java) - Christine Zhou”是免费的 — 只需登录并点击“下载”即可获取原始文件。
这份文档有多少页?
该文档共有 19 页,适用于课程 Lập trình Java。您可以在下载前进行在线预览。
我可以在下载前预览吗?
是的。您可以通过在线阅读器直接在本页面预览此文档,然后再决定是否下载。
Inheritance (Discussion 4) (Kế thừa trong Java) - Christine Zhou
正在生成预览...
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
阅读全文
- 文档名称
- 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
- 页数
- 19 页
- 上传者
- Uni24h
评论 (0)
暂无评论。快来抢沙发吧!
Misc.onclusion (Discussion 14-END) (Ôn tập cấu trúc dữ liệu) - Christine Zhou
Final Review Solutions (Cấu trúc dữ liệu heap, hàng đợi ưu tiên và duyệt đồ thị) - Ching and Christines
Giáo trình Lập trình Java
Inheritance (Discussion 4) (Kế thừa trong Java) - Christine Zhou
Asymptotic Analysis (Discussion 7) (Phân tích tiệm cận) - Christine Zhou
Chương 7.Cơ học lượng tử - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 6.Quang học lượng tử - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 5.Thuyết tương đối - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 4. Tán xạ ánh sáng - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 3.Phân cực ánh sáng - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
评论 (0)
暂无评论。快来抢沙发吧!