Tina Comston Comp-111 Week 5 Franklin University |
||||
Week 5 | ||||
Preparation
|
||||
Guided
Learning Activity |
||||
Assignment
- no homework this week Implicit versus Explicit parameters Parameters are values that are passed to methods when called. Implicit parameter - this parameter is always passed to a method. This parameter is "implied". This parameter is the object that is calling the method. tmpClient.getAddress(); In the above call to the method getAddress(), the object that is calling the method is the tmpClient object. tmpClient is the implicit parameter. Explicit parameter - this parameter(s) may or may not be passed to a method. The explicit parameter(s) are included within the parenthesis of the method call. There may be none to many explicit parameters passed to a method. tmpClient.setAddress("123 Main St."); In the above call to the setAddress() method, the explicit parameter is "123 Main St". YouTube video on implicit versus explicit https://www.youtube.com/watch?v=0Pr5A9R2s-s this keyword When writing a class, you do not know what objects will be created or what object variable names will be given to that object. But you do know the instance variables and methods that will be available to the object because you have written the blueprint for the object in your class. In the object you will need to be able to refer to the instance variables of the object, the methods of that object etc. To do that you use the "this" keyword. For example this.name = inName; this.name refers to the instance variable of an object Above you learned the difference between an implicit and explicit parameter. In essence the "this" keyword is referring the implicit parameter. YouTube video on the "this" keyword https://www.youtube.com/watch?v=8hgzqEi9b64 |
||||
Exam 1
|
||||
Reflection
Paper
|
||||
Lab 2
|