Inheritance (Discussion 4) (Kế thừa trong Java) - Christine Zhou
Génération de l'aperçu...
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ụ.
Description
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
Résumé IA
- Nom du document
- Inheritance (Discussion 4) (Kế thừa trong Java) - Christine Zhou
- École / Cours
- University of California, Berkeley · Lập trình Java
- Auteur (dans le document)
- Christine Zhou
- Contenu
- Tài liệu về kế thừa trong lập trình hướng đối tượng
- Table des matières
- Announcements
- Review: Inheritance
- Review: More Inheritance
- Review: Static/Dynamic Types
- Pages
- 19 pages
- Téléversé par
- Uni24h
Foire aux questions
Ce document est-il gratuit ?
Oui. « Inheritance (Discussion 4) (Kế thừa trong Java) - Christine Zhou » est gratuit — il suffit de vous connecter et de cliquer sur Télécharger pour obtenir le fichier original.
Combien de pages compte ce document ?
Le document contient 19 pages, pour le cours Lập trình Java. Vous pouvez le prévisualiser en ligne avant de le télécharger.
Puis-je prévisualiser avant de télécharger ?
Oui. Vous pouvez prévisualiser ce document directement sur cette page avec le lecteur en ligne, puis décider de le télécharger ou non.
Inheritance (Discussion 4) (Kế thừa trong Java) - Christine Zhou
Génération de l'aperçu...
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
Lire le document entier
- Nom du document
- Inheritance (Discussion 4) (Kế thừa trong Java) - Christine Zhou
- École / Cours
- University of California, Berkeley · Lập trình Java
- Auteur (dans le document)
- Christine Zhou
- Contenu
- Tài liệu về kế thừa trong lập trình hướng đối tượng
- Table des matières
- Announcements
- Review: Inheritance
- Review: More Inheritance
- Review: Static/Dynamic Types
- Pages
- 19 pages
- Téléversé par
- Uni24h
Commentaires (0)
Aucun commentaire pour le moment. Soyez le premier !
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
Commentaires (0)
Aucun commentaire pour le moment. Soyez le premier !