All those who write programs know that when you gradually expand on the functions you want to implement, when you are very big, you forget to write what you wrote on the first day the next day. Many times, you have to write detailed program development notes. This is especially when files and functions are complicated in ASP system development. When we plan to modify some functions of the website, we feel that we have no idea where to start or feel that we need to modify them. At this time, if you have learned any object-oriented programming language, you will naturally think of how to implement module language with code functions. Asp is not object-oriented programming in essence, but VBSCRPIT 6.0 provides classes, and we can implement code encapsulation through classes to implement module language.
First of all, I want to write some very official concepts here, which is intended to illustrate that object-oriented is a very concrete and physical pattern, and some people cannot be scared away when they see the "object".
An object is something that can be seen, felt, heard, touched, tasted or smelled. Here we "define" it like this: an object is a self-contained entity identified by a set of identifiable characteristics and behaviors.
In the programming method of object-oriented programming (OOP), use the following two terms.
Class: This is the template of the object, which defines the properties of the object.
Example: This is a real object, something that can interact with.
Properties, methods and events
In OOP, the following terms describe the properties of an object:
Attribute: This is a ranking that describes the properties of an object.
Method: This is a verb that describes the work that an object can do, or what it wants it to do.
Event: Describes the operation performed by the object for a corresponding action.
When programming, the object-oriented programming and object-oriented design part of the object have a very big advantage, which many people think is a complex topic, but in fact, it is very simple and can be explained in four simple terms: abstraction, encapsulation, polymorphism, and inheritance.
Abstract: This is a hidden complexity, the internal workings of the class, so the user does not have to know how it works, like. If you want to watch TV, you don’t have to know how the TV works. Just turn on the TV and search for the channel. The on/off switch abstracts the actual operation. In the string example, there is a trim method that can delete the spaces at the end of the string. You don’t need to know how it completes this task, just know that it has this function.
Encapsulation: Each object contains all the information needed to perform operations. This object is called encapsulation, so the object does not rely on other objects to complete its own operations. In the term TOupper() method, string does not have to obtain information elsewhere to convert all characters into capitalization.
Polymorphism: This term is used to indicate that different objects can perform the same actions, but must be executed through their own implementation code, with the same name, but the underlying implementation code is different.
Inheritance: It defines how classes are associated with each other, share features, inheritance works by defining classes and subclasses, where subclasses inherit all features of the parent class. The importance of inheritance is that it forces classes of similar types to be consistent and allows shared code, and if you decide to create a new class, you don't have to define all features of the parent class.