Introduction 1.3.2 OOP
Object-oriented thinking on the use of an intuitive understanding of the real world, when the use of computerized depth of abstraction can be summarized briefly as follows:
System is composed of things, there is a connection between things, the complexity is system;
System and the system, and things, things and things is a clear boundary between the (boundary) of;
System or the state of things can describe the property, said property is usually some simple data, if that is something the complex;
System or the state of things will change, called the behavior of a difference there is a reason (internal or external), changes in the process may be complex;
Will have different things in common between the properties and behavior, a common extreme case is completely contained.
Based on the above understanding, a runtime (dynamic) to the specific system or something, by several smaller things that constitute a specific (extreme things is a simple attribute data), which is constantly changing. If this concept of things an effective abstract, then the problem is solved.
First of all, any one specific thing called the object (Object), it is the extreme case of previous variables; things are classified, each class of things have the properties and behavior of uniform, that type - abstract data types, referred to as for the class (Class); behavior since it is the process, then a function of the abstract, named for the method to show the difference. For example:
Describe the height or name, each just a simple data variable;
Describe a student, you can use the student number, name, dorm, class, etc.; What kind of accommodation that replaced it!
It describes the dorm, class, and also has many projects.
1.4 Object-oriented programming concepts and features of the main
Object-oriented programming (Object Oriented Programming, OOP) language, in order to be more highly abstract, will introduce some of the real world, the concept is difficult to find, but for a programming language is indeed valuable. The following describes the concept of being basically derived from the abstract to the real world, from the role of program design to understand them.
Object-oriented programming to make the system easier to understand, but also make the code better reusability, scalability, easy management and maintenance. 1.4.1 Main Concepts 1, class
Class is the abstract of a class of things that the data type is equivalent to its role, of course, can be regarded as complex data types. Such as students, dormitories, class. 2, the object
Object represents a specific thing, its role is variable, that is, a complex data type - xx class variables. Such as Zhou Yu, Zhang Fei, Yu fly home, Tiger classes. 3 members
The elements of a thing to discuss when the class is virtual, it is the discussion of specific objects. As in class, a variable belonging to members - member variable, an object also belong to members - members of the object, a function also belong to the members - members of the method. 1.4.2 Main Features
There are three features of OOP languages: encapsulation, inheritance and polymorphism. 1 package
The composition includes members of the class variables / objects and members of the method, so the relevant data and functions will be packaged together with other distinguished class is package. Obviously, avoiding the process-oriented parallel language defects, indicating the class and members of their respective relationships. Further, members of the class can limit the visibility of the external, then the package will reflect the more perfect. 2, inheritance
When a thing is another thing entirely a special case of B, then, in general, the class A class B is more than the number of member variables / objects and members of the method, called class A inherits class B and class A is called ( Class B's) sub-class, class B is called (Class A) for the parent class.
Parent, also known as the base class, superclass, subclass, also known as derived class, derived class.
Obviously there is no need to write duplicate subclass the parent class to write some code in Part B, which is the most typical OOP code reuse. 3, multi-state
Polymorphism that an act of a class there are several implementation version. The simplest case is in a class, given a variety of different implementations, the complex is in many different sub-classes are given in their implementation. * 1.5 Java and C + + Differences 1.6 Chapter Summary Exercise
1. Java language to explain the three platforms.
2. Support the Java language to explain the three main technical goals (checking and data integrity.)
3. Object-oriented and process-oriented different from the problems and issues that both understand the point of view, in accordance with the individual's understanding and awareness of, for example, show the different places