If you are an active Server page (ASP) developer, it is believed that you may often use COM objects to create ASP pages. Even when you use it, you ignore that he is a COM object. For example: ADO. The only component with the highest call rate is the ability to extend unlimited functionality to your page. However, the ASP itself is an interpretative script that is not functional enough to COM strong. As a rapid development, ease of use, support COM VB Natural as the ASP in the development of COM's primary tool. The following demonstration and description, through the Visual Basic language, tells you how to write the COM and COM object models, and I believe you will get something.
What is the difference between a property and a method?
Describe the main point of a property?
What is the meaning of a read-only property?
What is a collection object?
What is a standard attribute in a collection object?
........
COM is an object-oriented standard that only methods and properties are defined in a COM object. They have no other interfaces, methods can have parameters, properties cannot, properties have read/write properties, and methods can return a value.
Property
property does not receive any parameters and is typically used to describe object state or set an object. All properties return a value, while some properties are read-only and some are read/write. Here's a visual Basic syntax example to help you interpret attributes:
Example 1
Read
value = object.property
Write
object.property = value
Note: There are no familiar parentheses here, just like the variable assignment. Here is the difference from the method (Function/sub). The above is to set a property in visual Basic syntax.
Method
Method can return a value or assignment, usually by using an object initialization event, or by a Function procedure call. Method can be assigned a value, but only exists with the argument list, if a method has no arguments, then the syntax is as follows:
Example 2
value = object.method()
Note that in Example 2 this method is set to null (), and the method can have a return value that must have a band (). For example, this connection object has an execution method and returns a Recordset object. Here is an example:
Example 3
Set Rs = Conn.Execute ("select * from table")
method does not return a value, and there is no () in the parameter. For example, the Close method in a Connection object.
Example 4
Conn.Close