TAILIEUCHUNG - Packages and Importing Classes

Gói và nhập khẩu lớp học Bạn đã biết được rằng một classpath điểm cho một hoặc nhiều thư mục. Mỗi thư mục có thể chứa các lớp (. Là) các tập tin. Ngoài ra để chứa các tập tin lớp học, một thư mục có thể chứa các thư mục con classpath | Packages and Importing Classes You have learned that a classpath points to one or more directories. Each of these directories can contain class .as files. In addition to containing class files a classpath directory can contain subdirectories. A subdirectory in a classpath directory is known as a package and can contain class files and more directories called subpackages. Keeping classes in packages is a good way to keep them organized. You might have hundreds of class files after just a few months of programming with Flash. Saving these classes in a logical directory structure makes them easier to locate and can help you avoid class-name conflicts with multiple projects. When you use packages the class file syntax changes slightly and can complicate instantiating an instance of that class. As shown earlier this is the basic syntax used to create a class called TestClass class TestClass function TestClass Constructor The rule that we didn t mention earlier is that the name declaration of the class must contain the path to the class file from the root classpath directory in which the class resides. The TestClass class above assumes that the class file is not in any package but is sitting directly in a classpath directory. However if we decided to create the TestClass class in a package called TestPackage the class definition would look like this class function TestClass Constructor The text after the class keyword contains not only the name of the class TestClass but the overall path where it exists. In this case TestClass exists inside the TestPackage directory which itself exists in a classpath directory. Suppose you created an address book class for Macromedia. Because you re a very organized person you created a logical package directory structure for your class file. The class definition might look like this class function AddressBook Constructor This class is contained in the Macromedia directory which is in

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.