Presentation is loading. Please wait.

Presentation is loading. Please wait.

Haidong Xue Summer 2011, at GSU

Similar presentations


Presentation on theme: "Haidong Xue Summer 2011, at GSU"— Presentation transcript:

1 Haidong Xue Summer 2011, at GSU
Principles of Computer Programming (using Java) Chapter 10 Writing Classes Haidong Xue Summer 2011, at GSU

2 Content Test2 Information Hiding Life scope and visible scope
Method Overloading Constructor and variable initialization

3 Test 2 Average: 71.6 [0, 60) : 10 [60, 80): 9 [80, 100]: 9 Answers

4 Information Hiding What is information hiding? Why? Rule:
Easy to test and debug Easy to maintain Protect variables from invalid values Rule: Generally, always make the member variables private

5 Life scope and visible scope
Member variables Local variables Parameter variables Objects Hidden variables Reason: same names Solution: using this

6 Method overloading What is method overloading? Signature
Name, and the type of parameters

7 Constructors and variable initialization
How to initialize the member variables? What is member variable initialization? What if there is no initialization at all? The default values? What if there is a conflict? The initialization order Using constructors in constructors

8 Next class Inheritance Overriding Polymorphism “Object” class

9 Assignment 7 Improve previous assignments, using the knowledge you learnt today.


Download ppt "Haidong Xue Summer 2011, at GSU"

Similar presentations


Ads by Google