TAILIEUCHUNG - CRC.Press A Guide to MATLAB Object Oriented Programming May.2007 Episode 1 Part 6

Tham khảo tài liệu ' a guide to matlab object oriented programming episode 1 part 6', kỹ thuật - công nghệ, cơ khí - chế tạo máy phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 74 A Guide to MATLAB Object-Oriented Programming SUMMARY The descriptions and implementations of subsref and subsasgn are the most involved topics in this book. They are also among the most important. It turns out that the implementations are difficult precisely because they are so important. Each case in the dot-access switch statement corresponds to a public member variable. Thus subsref and subsasgn represent much of the interface and their contents implement the conversions between public and private member variables. The tailored versions must also be able to handle object arrays and vector syntax. Getting all of this right for every class we develop isn t easy. One thing we learned in this chapter is to involve MATLAB built-in functions whenever possible. The built-in functions provide functionality that is documented tested and fast. Another thing we have learned from experience is the process of managing complexity by breaking it down into smaller units that are more manageable. Later we will investigate a convenient way to do this. It took us several attempts but in the end we achieved the goal of building a class interface that mimicked the structure interface. Overloading subsref and subsasgn also allowed us to introduce the concept of public member variables and define the relationship between public and private members. At first it appeared that supporting dot-reference array-reference and cellreference operators would degrade encapsulation. By the time we finished with the implementations these operators actually enhanced its benefits. The real power of the interface resulted from the ability to hide combine and manipulate private member variables on their way to and from the public interface. class _ CE call ncapsulatlon LpubllcL Overloafhi private Dlre ctOry FIGURE Puzzle with subsref subsasgn builtin and overloading. The implementations of subsref and subsasgn required a discussion of substruct and forced the issue of general operator

TỪ KHÓA LIÊN QUAN
Đã 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.