The concept of class JavaScript ES6

  • Class (Class): defines the abstract characteristics of a thing, it contains properties and methods

  • Object (Object): instance of a class by newgenerating

  • Object Oriented (OOP) three properties: encapsulation, inheritance, polymorphism

  • Package (Encapsulation): details of the operation of the data will be hidden and only exposed to the external interface. The outside world does not need to call the end (and can not) know the details, will be able to access the object through the interface provided externally, but also ensure that the outside world can not arbitrarily change the object's internal data

  • Inheritance (Inheritance): subclass inherits the parent class, subclass addition to all the features of the parent class, there are some more specific features

  • Polymorphism (Polymorphism): generated by a succession of different classes related, may have different responses to the same method. For example, Catand Dogare inherited from Animal, but are to achieve their eatmethods. At this time, for one example, we need to understand it is Catstill Dog, you can directly call the eatmethod, the program will automatically determine how it should be executedeat

  • Accessor (getter & setter): to change the properties and the assignment of reading behavior

  • Modifiers (Modifiers): modifier are some keywords, for defining the nature or type of member. For example publicrepresents the public properties or methods

  • Abstract (Abstract Class): abstract class is inherited by other classes of base class is instantiated abstract class is not allowed. Abstract class abstract method must be implemented in a subclass

  • Interface (Interfaces): public properties or methods of different classes, can be abstracted into a single interface. Interface may be implemented class (implements). A class can inherit from another class, but can implement multiple interfaces

Guess you like

Origin www.cnblogs.com/yangjinggui/p/12061457.html