Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Một khi bạn thiết lập một đại biểu, bạn có thể chạy các phương pháp sau, chỉ bằng cách sử dụng các đại biểu: 'Cuộc gọi CapitalizeName () chức năng và gán giá trị trả về' để UCaseName. Dim UCaseName Như UCaseName chuỗi = MyDelegate ("Samantha Jones") | Visual Basic 2005 data types such as arrays strings and even integers are actually full-featured objects. In Chapter 4 the plot thickened with forms which were also exposed as a special type of object. As this book continues you ll learn how to create your own custom objects and use them for a variety of programming tasks. But before you can get there you need a crash course in object-oriented programming. That s where this chapter comes in. To make the best use of .NET objects and to enhance your own applications you should develop a good understanding of object-oriented concepts. You may have already learned how to use classes and objects with a previous version of Visual Basic or another programming language. Even so you ll probably still want to read through the majority of this chapter and the next to explore the object-oriented features of VB 2005 and to get the big picture of the world of classes interfaces and object relationships. New in .NET Visual Basic 2005 s enhanced OOP features first appeared in .NET 1.0 when they were among the most hotly anticipated language changes. Visual Basic 2005 keeps all of these features and adds a few more which you ll learn about in Chapter 6 . At last Visual Basic includes all the hallmarks of a true object-oriented language. In this chapter you ll see some of the following changes The Class keyword In Visual Basic 6 each class required a separate file. Now you can group your classes any way you want as long as you place all classes inside declarations for example start with Public Class MyClassName and end with End Class . The Is keyword In VB 2005 you test whether two objects are the same by using the Is keyword for example If objOne Is objTwo Then not the equal sign. Constructors You can now use constructors to preload information into an object in a single line. Initializing objects can t get any easier. Garbage collection Garbage collection replaces deterministic finalization. When you set an object to Nothing it .