Chapter 6 Object-Oriented Programmin g The Concept of Class and Object Encapsulation mechanism Data member Member method Access permission modifier Keyword this Java语言程序设计(上) 1 The Concept of Class and Object The problem domain of programming, the objective world, is compose d of many things, which can be tangible (such as a car) or intangible (s uch as a meeting).Object is the mapping of objects in the objective wor ld to object-oriented programming.Object is a program unit used to de scribe objective things in object-oriented programming.Many objects i n the objective world, whether their attributes or their actions, often ha ve many commonalities. To abstract the commonalities of these object s can form classes.Therefore, classes are abstraction and induction of o bjects, and objects are instances of classes. Java语言程序设计( 2 Abstract principle The so-called abstraction refers to discarding individual, non-essential, or non-e ssential secondary characteristics from the subject of study, and extracting and i nvestigating the substantive content related to the research work, so as to form a correct, concise and concise understanding of the research issues.For example, "horse" is an abstract concept, in fact, no two horses are exactly the same, but w e abandon the differences between individual horses, extract their common, ess ential characteristics, and form the concept of "horse". Abstraction is a method often used in scientific research and a necessary means t o form concepts.In the field of computer software development, abstraction prin ciple is widely used. Generally speaking, it can be divided into process abstractio n and data abstraction. Java语言程序设计( 3 1. Process abstraction Process abstraction means that a software developer can regard any se quence of operations that complete a defined function as a single entit y, although it may actually be accomplished by a series of lower-level o perations.Using process abstraction, software developers can decomp ose a complex function into some sub-functions (modules). If the sub-f unctions are still complex, they can decompose further.This allows dev elopers to think at different levels of abstraction, and at higher levels t hey can think without paying attention to lower levels of implementati on details.Process-oriented programming uses process abstraction me thod. Using process abstraction is beneficial to control and reduce the complexity of th e whole program. However, this method allows the description of functions in the whole system. It has a large degree of freedom, is difficult to standardize and stan dardize, and is not easy to guarantee the quality of software, and it is also difficult to operate. Java语言程序设计( 4 2. Data abstraction Data abstraction combines the data that need to be processed in the sy stem with the operations imposed on these data, and abstracts them i nto different abstract data types according to the functions, properties, functions and other factors.Each abstract data type contains both data and authorization operations for these data, and limits the value of dat a to be observed and modified only by these operations.Therefore, dat a abstraction is a more rigorous and reasonable abstraction method th an process abstraction. Object-oriented programming uses the method of data abstraction to construct classes and objects in programs.It emphasizes the inte gration of data and operations into an indivisible system unit - obje ct, the object's external only need to know what the object can do, not how it does. Java语言程序设计( 5 object As long as we carefully study the problem domain faced by programming the objective world, we can see that the objective world is composed of so me specific things, each thing has its own set of static characteristics (attr ibutes) and a set of dynamic characteristics (behavior).For example, a car has static characteristics such as color, model, horsepower, manufacturer, and dynamic characteristics such as driving, turning and parking.Mapping the fact of the objective world to object-oriented programming abstracts t he things in the problem domain into objects, the static characteristics (att ributes) of things are described by a set of data, and the dynamic characte ristics (behaviors) of things are described by a set of methods.Therefore, th e object has the following characteristics: Java语言程序设计( 6 object (1) Object identification: that is, the name of the

pptDoc Java objects and classes

Professional Docs > Common > Other > Preview
64 Pages 0 Downloads 210 Views 3.0 Score
Tips: Current document can only be previewed at most page8,If the total number of pages in the document exceeds page 8,please download the document。
Uploaded by admin on 2019-10-16 00:29:59
You can enter 255 characters
What is my domain?( )
  • No comments yet