2wh20.jrvturnhout.nl

OO Programming with Java Ruurd Kuiper (Kees Huizing) More classes, more objects: object structures Programs are complex, so humans need program structuring Decomposition and abstraction of code for DATA and manipulation Grouping and naming of DATA and manipulation code for subtasks - For PROGRAMMING a subtask, WRITE a class, for getting a subtask PERFORMED, WRITE (!) that an object of that class is INSTANTI- More classes - class BankOne, class Account 1. Account for the DATA and manipulation of a personal balance Issues (see BankOne example): Instantiating (creating) Bank and Ac- count (done in Bank), connecting Bank and Account (reference variables, done in Bank), activating the methods of bank and Account (control transfer, starting from Bank), what to hide for abstraction (all variables, More classes - class BankOne, class Account See annotated (carefully read the annotation!) example program in Aim: To use the same name for methods that perform essentially the same tasks, but only differ in input parameters Means: Overloading - just do it, using the difference in parameter lists Constructors Aim: To initialize the instance variables of an objectbefore any other code is executed on the object method with as name the name of the class that it belongs to. A con- structor is automatically called, directly when an object is created. By convention, the definitions of the constructors are positioned before the other methods in the class, just after the declaration of the instance A class can have several constructors. Overloading is used to distinguish between these, i.e., the constructors differ in the parameters they have.
When an object is created, values for parameters (the arguments) are given in the new-clause, between the parentheses following the class The types of these arguments, and possibly their order, deter- mine which constructor will be executed.
See annotated (carefully read the annotation!) example programs in For PROGRAMMING a subtask, WRITE a CLASS, for getting a subtask PERFORMED, WRITE (!) that an OBJECT of that class is INSTAN- TIATED - IF SO DESIRED, FROM THE SAME CLASS Issues (see BankMore example): Distinguishing between/accessing sev- eral instantiations of a class (reference variables) See annotated (carefully read the annotation!) example program in In the examples so far, the communication between objects was verylimited: the mechanism for communication was the method call • An object can (has the option to) communicate with another object iffit has a reference variable, like account that holds the (invisible)address of the other object; • an object does (takes the initiative to) communicate with another object iffit calls a method of that other object, like account.add100(); The effect is, that control (as visualized by the > in the executionmodel) is transferred - not data Data transfer - parameterized/returning method calls Aim: Communicating data values between objects Methods with parameters (to an object) and return (from an Control was transferred between objects by method calls: from calling Now the methods are used to also transfer data in both direction - but the option and initiative are still with the object that holds the reference See annotated (carefully read the annotation!) example program in Data transfer - parameterized/returning method calls • An object can (has the option to) send or obtain data to or from it has a reference variable, like account that holds the (invisible) • an object does (takes the initiative to) send or obtain data to or from it calls a method of that object, like account.add100(); The effect is, that the data (as visualized by the > in the execution model) is transferred to or from the referenced object to the object that holds Reference data transfer - parameterized/returning methodcalls Aim: Communicating reference data values between objects Methods with parameters (to an object) and return (from an Methods are used to also transfer reference data in both directions; the option and initiative are as always with the object that holds the reference The reference, address, values are not accessible to “us”, therefore only variables that hold these values can be used Reference data transfer to an object - BankReferen-ceParameters See annotated (carefully read the annotation!) example program in Reference data transfer from an object - BankRefer-enceReturn See annotated (carefully read the annotation!) example program in

Source: http://2wh20.jrvturnhout.nl/Downloads/Week5/Slides_Week_5_Lecture_6_Classes_and_Objects.pdf

White lithium grease

FICHE TECHNIQUE CRC WHITE LITHIUM GREASE Graisse blanche au lithium 1. DESCRIPTION GENERALE Lubrifiant à hautes performances au PTFE (*). Graisse blanche multi-usages, de grande qualité, pour l’automobile, l’atelier et l’habitation. Assure une lubrification de longue durée avec excellente résistance à l’eau et à la chaleur. Sa consistance douce et molle et ass

studiomedicosacco.it

CURRICULUM VITAE DR. RAFFAELE SACCO CURRICULUM FORMATIVO-PROFESSIONALE Nato a Lanciano (CH) il 26 aprile 1958 Laurea in Medicina e Chirurgia, conseguita il 24 ottobre 1986 presso l'Università degli Studi di Milano con il voto di 101/110. Tesi di laurea: Chirurgia exodontica in pazienti affetti da emofilie e da malattie di Von Willebrand: possibilità di trattamenti senza emoderivati Abilita

Copyright © 2010-2014 Medical Articles