Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 115 Week 10 March 17 - 21, 2008. Announcements March 21 – Lab 7 Q & A in lecture March 21 – Lab 7 Q & A in lecture March 26 – Exam 7 March 26 – Exam.

Similar presentations


Presentation on theme: "CSE 115 Week 10 March 17 - 21, 2008. Announcements March 21 – Lab 7 Q & A in lecture March 21 – Lab 7 Q & A in lecture March 26 – Exam 7 March 26 – Exam."— Presentation transcript:

1 CSE 115 Week 10 March 17 - 21, 2008

2 Announcements March 21 – Lab 7 Q & A in lecture March 21 – Lab 7 Q & A in lecture March 26 – Exam 7 March 26 – Exam 7 March 28 – Resign Deadline March 28 – Resign Deadline Note changes in due dates for Labs 7 & 8 – early/late points are different – see schedule page for details. Note changes in due dates for Labs 7 & 8 – early/late points are different – see schedule page for details. March 31 – Exam 8 March 31 – Exam 8

3 Weeks Notes The declared type and the actual type of a variable can only differ if the actual type is a subtype of the declared type. The declared type and the actual type of a variable can only differ if the actual type is a subtype of the declared type. If this difference occurs: If this difference occurs: –The only methods that can be called are those of the declared type –The methods that get executed are those of the actual type

4 Weeks Notes Inheritance (Generalization) Inheritance (Generalization) An interface can extend one or more other interfaces. If this is the case, the class that implements the sub- interfaces must give implementations to all the methods from all super- interfaces as well. An interface can extend one or more other interfaces. If this is the case, the class that implements the sub- interfaces must give implementations to all the methods from all super- interfaces as well.

5 Weeks Notes Abstract Classes Abstract Classes Class that has at least one abstract method Class that has at least one abstract method Keyword abstract is in the class header for an abstract class Keyword abstract is in the class header for an abstract class Keyword abstract is in the method header for abstract methods Keyword abstract is in the method header for abstract methods

6 Weeks Notes An abstract class can implement one or more interfaces An abstract class can implement one or more interfaces An abstract class can extend one other abstract class An abstract class can extend one other abstract class An abstract class can even extend one other concrete class An abstract class can even extend one other concrete class

7 Weeks Notes A concrete class can extend one other abstract class A concrete class can extend one other abstract class A concrete class can extend one other concrete class A concrete class can extend one other concrete class

8 Weeks Notes If you create an instance of a class that is a subclass of another class, what happens when you call the constructor? If you create an instance of a class that is a subclass of another class, what happens when you call the constructor? The constructor of the subclass must immediately call a constructor from the superclass The constructor of the subclass must immediately call a constructor from the superclass

9 Weeks Notes By default, the no-argument constructor of the superclass is called, but if there is no no-argument constructor, or you want to call a different constructor, you must explicitly do so using the keyword super By default, the no-argument constructor of the superclass is called, but if there is no no-argument constructor, or you want to call a different constructor, you must explicitly do so using the keyword super

10 Weeks Notes When a class inherits from another, it inherits all of the public methods and they remain public in the subclass When a class inherits from another, it inherits all of the public methods and they remain public in the subclass If we want to change the behavior of an inherited method, we can override the implementation If we want to change the behavior of an inherited method, we can override the implementation


Download ppt "CSE 115 Week 10 March 17 - 21, 2008. Announcements March 21 – Lab 7 Q & A in lecture March 21 – Lab 7 Q & A in lecture March 26 – Exam 7 March 26 – Exam."

Similar presentations


Ads by Google