Java programmers to share good interview questions: four basic features of object-oriented

  Good programmers to share Java interview questions: Object-oriented four basic features of object-oriented technology is a popular system design and development technologies, including object-oriented analysis and object-oriented programming. Object-oriented programming techniques is proposed, mainly to solve the conventional method of programming - Structured programming code reuse can not solve the problem.

 

  Object-oriented programming has four basic features:

 

  1. Abstract:

 

  Abstract is to ignore those aspects of a topic unrelated to the current target, in order to more fully pay attention to aspects related to the current target. Abstract does not intend to understand all the problems, but only select some of them, being not part of the details. For example, we want to design a student achievement management system, when students study this subject, we are only concerned about his class, school, performance, etc., without having to care about his height, weight information. Abstract includes two aspects, one procedural abstraction, and second, data abstraction. Abstract refers to any process of operating a well-defined function can be seen as a single entity to treat the user, although this operation may actually be performed by a series of lower-level operations. Data abstraction defines data types and operations applied to the type of the object, and defines a value of the object can only be modified by using these operations and observation.

 

  2. Inheritance: Inheritance is linked hierarchical model class, and to allow and encourage the reuse of classes, it provides a clearly stated in common. A new class of objects can be derived from existing classes, this process is called class inheritance. The new class inherits the properties of the original class, the new class known as the original class of the derived class (subclass), while the original class is called the base class for the new class (parent class). A derived class can inherit methods and instance variables from its base class, and the class may modify or add new method makes it more suitable for particular needs. It also reflects the general relationship between nature and special. We inherited a good solution to the problem of software reusability. For example, all Windows applications have a window, they can be regarded as are derived from a window class. However, application programs for word processing, some applications for drawing, which is derived due to the different sub-categories, each subclass adds different characteristics.

 

  3. Package:

 

  Packaging is one of the features of object-oriented concepts and the main properties of the object classes. Encapsulation is surrounded by the process and data, access to the data only through a defined interface. Object-oriented computing began in the basic notion that the real world can be represented as a series of fully autonomous, encapsulated objects that access other objects through a protected interface. Once the characteristics of an object is defined, it is necessary to determine the visibility of these characteristics, ie characteristics which are visible to the outside world, which are used to represent internal state. The object is defined at this stage interface. Generally, it should prohibit direct access to the actual representation of an object, but should be accessible through the user interface object, which is called information hiding. In fact, information hiding is user awareness of the encapsulation of the package was to support information hiding. Encapsulating module having better ensure independence, such modified program maintenance easier. Modify the application was limited to the class, which can be modified to reduce the impact to a minimum application.

 

  4. polymorphism:

 

  Polymorphism is to allow objects of different classes respond to the same message. Such as adding the same, time the two together and the two integers together certainly completely different. As another example, the same select Edit - paste operation, have different effects in a drawing program and a word processing program. Polymorphisms include parametric polymorphism containing polymorphism. Polymorphism flexible language, abstract, behavior sharing, code-sharing advantages of a good solution to the problem of the application function of the same name.

 

  Object-oriented programming has many advantages:

 

  1 , development time is short, high efficiency, high reliability, developed by the program stronger. Because of the reusability of object-oriented programming may be employed a large number of mature libraries in the application, thereby shortening the development time.

 

  2 , the application easier to maintain, update and upgrade. Effects of inheritance and encapsulation allows the application of modified bring more localized.

Guess you like

Origin www.cnblogs.com/gcghcxy/p/11090888.html