1 Java Object-oriented
SVG vector graph
node. js
Java
C
Object-c (Apple bottom) Swift
C++
C#
JavaScript (front desk)
Ruby
How object-oriented is created
1 using the new operator
2-character variable using the new operator
Creating objects
var user = new Object ();
User.Name = ' Programming prodigal ';
User.age = 22;
user.address = ' Chengdu, Sichuan ';
This makes it simple and intuitive to create objects, but the disadvantage is that when you need to create multiple objects,
This is not an appropriate method of creation (memory impact) in order to solve this problem we have a factory model
Factory mode: Resolves an issue where instantiating objects produce large amounts of duplicate code.
To create a new instance of the user object, use the new operator to build the instance object in this way, which takes the following 4 steps:
1. Create a new object;
2. Set the scope of the constructor to the new object (hence this new object that this is pointing to).
3. Execute the code within the constructor (add attributes to the new object);
4. Returns the new object.
3 constructors (treated as classes)
Class is not an object, just a representation of this type of extraction
Note: 1 The first letter of the reputation structure is capitalized.
2 When a function is called as a normal function, the pointer to the this object inside the function is actually pointing to the window global object.
In the case of the new keyword, this is the object.
3.1 Disadvantages of constructors
Method calls repeatedly, wasting memory
4 prototype prototype--object properties (object) pointers
5 Recommended constructors + prototype prototypes
6 What is a prototype?
The prototype object is actually an instance object of the constructor, and there is no intrinsic difference from the normal instance object.
You can include shared properties or methods for all instances of a specific type. The attribute value of this prototype is a
Object (a collection of attributes), the default is only a property called constructor, pointing to the function itself.
Java Object-oriented