Some basic definitions in as3, the difference between function and method

Source: Internet
Author: User

Adobe does not specifically describe some basic differences in the official English documents. Most of them are automatically translated or translated into Chinese, and there are some improper translations. the Ancients have clouds, but the difference is only a thousand miles. First, let's try to ask, what is the difference between function and method?

 

Function and method are translated into Chinese. I do not know how to translate them. It is better to use English. In as3, a function is a keyword defining a function, but it does not necessarily define a function or method.

1. Differences between method and Function

The method explicitly defined using the function keyword in the class is called the method. In addition, all the methods defined using the function keyword are called
Function. Function is similar to the Function Method in Js. This distinction helps to understand the concept of closure (closure) in as3.

2. What is property?

In as3, property should not be understood as a class attribute, but should be understood as a class element, including variables, methods, and setter/getter methods. From a perspective
In as3, the class has no attributes. the commonly used X, Y, width, and height cannot be called "attributes". They are setter/getter methods. In this way
Helps you understand trait objects.

3. What is type annotation )?

The translation of Type annotation into type declaration is not straight, and type annotation is only used by the compiler,CodeAlthough the amount increases, the performance improvement and code readability are in exchange. This is similar to the annotation function, and the translation for Type annotations is more appropriate.


VaR S: String = "sban ";


In the preceding example, string is a type comment or a variable type comment.

Public Function getwidth (): uint
{
//...
}


In the preceding example, uint is a type comment or a type comment.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.