DOC PREVIEW
UMD CMSC 131 - Lecture 12: Runtime Management

This preview shows page 1 out of 3 pages.

Save
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Lecture 12 Runtime Management Last time 1 Parameter passing 2 Libraries 3 Public vs private Today 1 runtime stack management 2 variable initialization 3 function overloading rules 4 this CMSC 131 Fall 2007 Jan Plane adapted from Bonnie Dorr Call Stack Keeps track of variables Stack Frames Stack Operations push pop Eclipse can show the stack CMSC 131 Fall 2007 Jan Plane adapted from Bonnie Dorr 1 Initialization of Variables Summary Local Variables Parameters Instance Variables Static Variables CMSC 131 Fall 2007 Jan Plane adapted from Bonnie Dorr 2 1 Overloading Methods Two methods with the same name but distinguishable parameter types Terminology prototype public static void f int x float y signature f int float names of variables and the return type are not part of it Can t differ only in return type Can t differ only in types that can be implicitly promoted between widening conversion when choices are equal in amount of conversion CMSC 131 Fall 2007 Jan Plane adapted from Bonnie Dorr 3 Implicit Promotions On general assignments On parameters On return value CMSC 131 Fall 2007 Jan Plane adapted from Bonnie Dorr 4 Most SUBTLE example Consider overloading like this void f int x double y void f double a int b Three Calls f 3 10 0 f 7 7 5 f 3 7 CMSC 131 Fall 2007 Jan Plane adapted from Bonnie Dorr 5 2 this a reference to the current object Only makes sense in a non static method In an instance method this is the object that is assumed easy to refer to members data or methods using the assumed object difficult to refer to the whole object without having a name to call it Only use when needed using it all the time makes the code more difficult to read CMSC 131 Fall 2007 Jan Plane adapted from Bonnie Dorr 6 3


View Full Document

UMD CMSC 131 - Lecture 12: Runtime Management

Documents in this Course
Set #3

Set #3

7 pages

Exam #1

Exam #1

6 pages

Exam #1

Exam #1

6 pages

Notes

Notes

124 pages

Notes

Notes

124 pages

Load more
Download Lecture 12: Runtime Management
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 12: Runtime Management and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 12: Runtime Management and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?