简介
Summary:
Publisher Summary 1
This guide covers the documented and undocumented object-oriented features of MATLAB. Register (Georgia Tech Research Institute) explains the required elements of MATLAB and developing a set of functions that give objects first-class status within the environment, covering eight functions that provide object initialization, a simple intuitive interface, interaction with the environment's features, and array capability. The following section covers strategies and implementations for the construction of hierarchies. The book ends with a section on advanced strategies and utilities. Readers are expected to have an intermediate level of MATLAB programming knowledge and superficial knowledge of object-oriented programming. The CD-ROM contains source code and the Class Wizard tool. Annotation 漏2007 Book News, Inc., Portland, OR (booknews.com)
目录
Figures p. xv
Code Listings p. xvii
Tables p. xxi
About the Author p. xxiii
Preface p. xxv
Chapter 1 Introduction p. 1
1.1 Examples p. 2
1.2 Object-Oriented Software Development p. 2
1.2.1 At the Top of Your Game p. 3
1.2.2 Personal Development p. 3
1.2.3 Wicked Problems p. 5
1.2.4 Extreme Programming p. 6
1.2.5 MATLAB, Object-Oriented Programming, and You p. 8
1.3 Attributes, Behavior, Objects, and Classes p. 9
1.3.1 From MATLAB Heavyweight to Object-Oriented Thinker p. 9
1.3.2 Object-Oriented Design p. 10
1.3.3 Why Use Objects? p. 11
1.3.4 A Quality Focus p. 12
1.3.4.1 Reliability p. 12
1.3.4.2 Reusability p. 13
1.3.4.3 Extendibility p. 14
1.4 Summary p. 15
Part 1 Group of Eight p. 17
Chapter 2 Meeting MATLAB's Requirements p. 19
2.1 Variables, Types, Classes, and Objects p. 19
2.2 What Is a MATLAB Class? p. 21
2.2.1 Example: Class Requirements p. 21
2.2.1.1 Class Directory p. 22
2.2.1.2 Constructor p. 22
2.2.1.3 The Test Drive p. 24
2.3 Summary p. 26
2.4 Independent Investigations p. 27
Chapter 3 Member Variables and Member Functions p. 29
3.1 Members p. 29
3.2 Accessors and Mutators p. 30
3.2.1 A Short Side Trip to Examine Encapsulation p. 31
3.2.1.1 cShape Variables p. 32
3.2.2 cShape Members p. 33
3.2.2.1 cShape Private Member Variables p. 33
3.2.2.2 cShape Public Interface p. 34
3.2.3 A Short Side Trip to Examine Function Search Priority p. 36
3.2.4 Example Code: Accessors and Mutators, Round 1 p. 37
3.2.4.1 Constructor p. 37
3.2.4.2 Accessors p. 37
3.2.4.3 Mutators p. 38
3.2.4.4 Combining an Accessor and a Mutator p. 39
3.2.4.5 Member Functions p. 40
3.2.5 Standardization p. 40
3.3 The Test Drive p. 41
3.4 Summary p. 42
3.5 Independent Investigations p. 43
Chapter 4 Changing the Rules...in Appearance Only p. 45
4.1 A Special Accessor and a Special Mutator p. 45
4.1.1 A Short Side Trip to Examine Overloading p. 45
4.1.1.1 Superiorto and Inferiorto p. 47
4.1.1.2 The Built-in Function p. 48
4.1.2 Overloading the Operators subsref and subsasgn p. 48
4.1.2.1 Dot-Reference Indexing p. 50
4.1.2.2 subsref Dot-Reference, Attempt 1 p. 51
4.1.2.3 A New Interface Definition p. 52
4.1.2.4 subsref Dot-Reference, Attempt 2: Separating Public and Private Variables p. 53
4.1.2.5 subsref Dot-Reference, Attempt 3: Beyond One-to-One, Public-to-Private p. 53
4.1.2.6 subsref Dot-Reference, Attempt 4: Multiple Indexing Levels p. 55
4.1.2.7 subsref Dot-Reference, Attempt 5: Operator Conversion Anomaly p. 57
4.1.2.8 subsasgn Dot-Reference p. 59
4.1.2.9 Array-Reference Indexing p. 62
4.1.2.10 subsref Array-Reference p. 63
4.1.2.11 subsasgn Array-Reference p. 64
4.1.2.12 Cell-Reference Indexing p. 65
4.1.3 Initial Solution for subsref.m p. 66
4.1.4 Initial Solution for subsasgn.m p. 68
4.1.5 Operator Overload, mtimes p. 69
4.2 The Test Drive p. 70
4.2.1 subsasgn Test Drive 24 p. 70
4.2.2 subsref Test Drive p. 72
4.3 Summary p. 74
4.4 Independent Investigations p. 75
Chapter 5 Displaying an Object's State p. 77
5.1 Displaying Objects p. 77
5.1.1 What Should Be Displayed? p. 77
5.1.2 Standard Structure Display p. 79
5.1.3 Public Member Variable Display p. 80
5.1.3.1 Implementing display.m, Attempt 1 p. 80
5.1.3.2 Implementing display.m, Attempt 2 p. 81
5.2 Developer View p. 83
5.2.1 Implementing display.m with Developer View Options p. 84
5.3 The Test Drive p. 86
5.4 Summary p. 88
5.5 Independent Investigations p. 88
Chapter 6 fieldnames.m p. 91
6.1 Fieldnames p. 91
6.2 Code Development p. 91
6.3 The Test Drive p. 93
6.4 Summary p. 93
6.5 Independent Investigations p. 94
Chapter 7 struct.m p. 95
7.1 Struct p. 95
7.2 Code Development p. 96
7.3 The Test Drive p. 97
7.4 Summary p. 98
7.5 Independent Investigations p. 98
Chapter 8 get.m, set.m p. 99
8.1 Arguments for the Member Functions get and set p. 99
8.1.1 For Developers p. 99
8.1.2 For Clients p. 100
8.1.3 Tab Completion p. 101
8.2 Code Development p. 101
8.2.1 Implementing get and set p. 102
8.2.2 Initial get.m p. 104
8.2.3 Initial set.m p. 107
8.3 The Test Drive p. 110
8.4 Summary p. 111
8.5 Independent Investigations p. 112
Chapter 9 Simplify Using get, set, fieldnames, and struct p. 113
9.1 Improving subsref.m p. 114
9.2 Improving subsasgn.m p. 115
9.3 Improving display.m p. 116
9.4 Test Drive p. 118
9.5 Summary p. 121
9.6 Independent Investigations p. 122
Chapter 10 Drawing a Shape p. 123
10.1 Ready, Set, Draw p. 123
10.1.1 Implementation p. 123
10.1.1.1 Modify the Constructor p. 124
10.1.1.2 Modify fieldnames p. 125
10.1.1.3 Modify get p. 125
10.1.1.4 Modify set p. 128
10.1.1.5 Modify mtimes p. 131
10.1.1.6 Modify reset p. 132
10.1.1.7 Adding Member Function draw p. 132
10.2 Test Drive p. 133
10.3 Summary p. 136
10.4 Independent Investigations p. 137
Part 2 Building a Hierarchy p. 139
Chapter 11 Constructor Redux p. 141
11.1 Specifying Initial Values p. 141
11.1.1 Private Member Functions p. 142
11.2 Generalizing the Constructor p. 143
11.2.1 Constructor Helper/private/ctor_ini.m p. 145
11.2.2 Constructor Helper Example/private/ctor_1.m p. 146
11.3 Test Drive p. 147
11.4 Summary p. 150
11.5 Independent Investigations p. 151
Chapter 12 Constructing Simple Hierarchies with Inheritance p. 153
12.1 Simple Inheritance p. 154
12.1.1 Constructor p. 154
12.1.2 Other Standard Member Functions p. 157
12.1.2.1 Child Class fieldnames p. 161
12.1.2.2 Child Class get p. 162
12.1.2.3 Child Class set p. 165
12.1.3 Parent Slicing in Nonstandard Member Functions p. 167
12.1.3.1 draw.m p. 168
12.1.3.2 mtimes.m p. 168
12.1.3.3 reset.m p. 169
12.2 Test Drive p. 169
12.3 Summary p. 173
12.4 Independent Investigations p. 174
Chapter 13 Object Arrays with Inheritance p. 175
13.1 When Is a cShape Not a cShape? p. 175
13.1.1 Changes to subsasgn p. 176
13.1.2 Vertcat and horzcat p. 177
13.1.3 Test Drive p. 178
13.2 Summary p. 182
13.3 Independent Investigations p. 182
Chapter 14 Child-Class Members p. 183
14.1 Function Redefinition p. 183
14.1.1 /@cStar/private/ctor_ini.m with Private Member Variables p. 184
14.1.2 /@cStar/fieldnames.m with Additional Public Members p. 184
14.1.3 /@cStar/get.m with Additional Public Members p. 185
14.1.4 /@cStar/set.m with Additional Public Members p. 186
14.1.5 /@cStar/draw.m with a Title p. 187
14.2 Test Drive p. 187
14.3 Summary p. 189
14.4 Independent Investigations p. 190
Chapter 15 Constructing Simple Hierarchies with Composition p. 191
15.1 Composition p. 191
15.1.1 The cLineStyle Class p. 192
15.1.1.1 cLineStyle's private/ctor_ini p. 193
15.1.1.2 cLineStyle's fieldnames p. 194
15.1.1.3 cLineStyle's get p. 195
15.1.1.4 cLineStyle's set p. 196
15.1.1.5 cLineStyle's private/ctor_2 p. 197
15.1.2 Using a Primary cShape and a Secondary cLineStyle p. 198
15.1.2.1 Composition Changes to cShape's ctor_ini.m p. 199
15.1.2.2 Adding Line Weight to cShape's fieldnames.m p. 199
15.1.2.3 Composition Changes to cShape's get.m p. 200
15.1.2.4 Composition Changes to cShape's set.m p. 201
15.1.2.5 Composition Changes to cShape's draw.m p. 202
15.1.2.6 Composition Changes to cShape's Other Member Functions p. 202
15.2 lest Drive p. 203
15.3 Summary p. 204
15.4 Independent Investigations p. 206
Chapter 16 General Assignment and Mutator Helper Functions p. 209
16.1 Helper Function Strategy p. 209
16.1.1 Direct-Link Public Variables p. 210
16.1.1.1 Get and subsref p. 210
16.1.1.2 Set and subsasgn p. 211
16.1.2 get and set Helper Functions p. 212
16.1.2.1 Helper functions, get, and set p. 212
16.1.2.2 Final template for get.m p. 213
16.1.2.3 Final Template for set.m p. 217
16.1.2.4 Color Helper Function p. 221
16.1.2.5 The Other Classes and Member Functions p. 222
16.2 Test Drive p. 222
16.3 Summary p. 223
16.4 Independent Investigations p. 224
Chapter 17 Class Wizard p. 225
17.1 File Dependencies p. 226
17.2 Data-Entry Dialog Boxes p. 226
17.2.1 Main Class Wizard Dialog p. 227
17.2.1.1 Header Information Dialog p. 229
17.2.1.2 Parents...Dialog p. 231
17.2.1.3 Private Variable...Dialog p. 232
17.2.1.4 Concealed Variables...Dialog p. 234
17.2.1.5 Public Variables...Dialog p. 235
17.2.1.6 Constructors...Dialog p. 237
17.2.1.7 More...Dialog p. 238
17.2.1.8 Static Variables...Dialog p. 239
17.2.1.9 Private Functions...Dialog p. 240
17.2.1.10 Public Functions...Dialog p. 242
17.2.1.11 File Menu p. 243
17.2.1.12 Data Menu p. 244
17.2.1.13 Build Class Files Button p. 245
17.3 Summary p. 246
17.4 Independent Investigations p. 247
Chapter 18 Class Wizard Versions of the Shape Hierarchy p. 249
18.1 cLineStyle Class Wizard Definition Data p. 249
18.1.1 cLineStyle Header Info p. 250
18.1.2 cLineStyle Private Variables p. 251
18.1.3 cLineStyle Public Variables p. 253
18.1.4 cLineStyle Constructor Functions p. 255
18.1.5 cLineStyle Data Dictionary p. 257
18.1.6 cLineStyle Build Class Files p. 258
18.1.7 cLineStyle Accessor and Mutator Helper Functions p. 259
18.2 cShape Class Wizard Definition Data p. 261
18.2.1 cShape Header Info p. 261
18.2.2 cShape Private Variables p. 261
18.2.3 cShape Concealed Variables p. 262
18.2.4 cShape Public Variables p. 263
18.2.5 cShape Constructor Functions p. 264
18.2.6 cShape Public Functions p. 265
18.2.7 cShape Data Dictionary p. 265
18.2.8 cShape Build Class Files p. 266
18.3 cStar Class Wizard Definition Data p. 268
18.3.1 cStar Parent p. 268
18.3.2 Other cStar Definition Data p. 269
18.4 cDiamond Class Wizard Definition Data p. 271
18.5 Test Drive p. 271
18.6 Summary p. 272
18.7 Independent Investigations p. 275
Part 3 Advanced Strategies p. 277
Chapter 19 Composition and a Simple Container Class p. 279
19.1 Building Containers p. 279
19.2 Container Implementation p. 280
19.2.1 The Standard Framework and the Group of Eight p. 280
19.2.1.1 Container Modifications to fieldnames p. 281
19.2.1.2 Container Modifications to subsref p. 283
19.2.1.3 Container Modifications to subsasgn p. 285
19.2.1.4 Container Modifications to get p. 287
19.2.1.5 Container Modifications to set p. 289
19.2.2 Tailoring Built-in Behavior p. 290
19.2.2.1 Container-Tailored end p. 291
19.2.2.2 Container-Tailored cat, horzcat, vertcat p. 291
19.2.2.3 Container-Tailored length, ndims, reshape, and size p. 293
19.2.3 cShapeArray and numel p. 294
19.2.3.1 Container-Tailored num2cell and mat2cell p. 295
19.2.4 Container Functions That Are Specific to cShape Objects p. 296
19.2.4.1 cShapeArray times and mtimes p. 296
19.2.4.2 cShapeArray draw p. 298
19.2.4.3 cShapeArray reset p. 299
19.3 Test Drive p. 299
19.4 Summary p. 302
19.5 Independent Investigations p. 302
Chapter 20 Static Member Data and Singleton Objects p. 303
20.1 Adding Static Data to Our Framework p. 303
20.1.1 Hooking Static Data into the Group of Eight p. 304
20.1.1.1 Static Variables and the Constructor p. 305
20.1.1.2 Static Variables in get and set p. 305
20.1.1.3 Static Variables in display p. 306
20.1.2 Overloading loadobj and saveobj p. 307
20.1.3 Counting Assignments p. 308
20.2 Singleton Objects p. 308
20.3 Test Drive p. 309
20.4 Summary p. 311
20.5 Independent Investigations p. 312
Chapter 21 Pass-by-Reference Emulation p. 313
21.1 Assignment without Equal p. 313
21.2 Pass-by-Reference Functions p. 314
21.3 Pass-by-Reference Draw p. 315
21.4 Pass-by-Reference Member Variable: View p. 316
21.4.1 Helpers, get, and subsref with Pass-by-Reference Behavior p. 316
21.4.1.1 Pass-by-Reference Behavior in the Helper p. 317
21.4.1.2 Pass-by-Reference Code in get.m p. 318
21.4.1.3 Pass-by-Reference Code in subsref.m p. 321
21.4.2 Other Group-of-Eight Considerations p. 321
21.5 Test Drive p. 322
21.6 Summary p. 324
21.7 Independent Investigations p. 324
Chapter 22 Dot Functions and Functors p. 327
22.1 When Dot-Reference Is Not a Reference p. 327
22.2 When Array-Reference Is Not a Reference p. 332
22.2.1 Functors p. 333
22.2.2 Functor Handles p. 334
22.2.3 Functor feval p. 335
22.2.4 Additional Remarks Concerning Functors p. 335
23.3 Test Drive p. 336
22.4 Summary p. 337
22.5 Independent Investigations p. 337
Chapter 23 Protected Member Variables and Functions p. 339
23.1 How Protected Is Different from Other Visibilities p. 339
23.2 Class Elements for Protected p. 339
23.2.1 Protected Functions and Advanced Function Handle Techniques p. 340
23.2.2 Passing Protected Handles from Parent to Child p. 340
23.2.3 Accessing and Mutating Protected Variables p. 341
23.2.4 Calling Protected Functions p. 343
23.3 Test Drive p. 344
23.4 Summary p. 345
23.5 Independent Investigations p. 346
Chapter 24 Potpourri for $100 p. 347
24.1 A Small Assortment of Useful Commands p. 347
24.1.1 Objectdirectory p. 347
24.1.2 Methods and methodsview p. 347
24.1.3 Functions p. 348
24.2 Other Functions You Might Want to Overload p. 348
24.2.1 Functions for Built-in Types p. 348
24.2.2 subsindex p. 349
24.2.3 Isfield p. 349
24.3 Summary p. 350
24.4 Independent Investigations p. 350
Index p. 351
Code Listings p. xvii
Tables p. xxi
About the Author p. xxiii
Preface p. xxv
Chapter 1 Introduction p. 1
1.1 Examples p. 2
1.2 Object-Oriented Software Development p. 2
1.2.1 At the Top of Your Game p. 3
1.2.2 Personal Development p. 3
1.2.3 Wicked Problems p. 5
1.2.4 Extreme Programming p. 6
1.2.5 MATLAB, Object-Oriented Programming, and You p. 8
1.3 Attributes, Behavior, Objects, and Classes p. 9
1.3.1 From MATLAB Heavyweight to Object-Oriented Thinker p. 9
1.3.2 Object-Oriented Design p. 10
1.3.3 Why Use Objects? p. 11
1.3.4 A Quality Focus p. 12
1.3.4.1 Reliability p. 12
1.3.4.2 Reusability p. 13
1.3.4.3 Extendibility p. 14
1.4 Summary p. 15
Part 1 Group of Eight p. 17
Chapter 2 Meeting MATLAB's Requirements p. 19
2.1 Variables, Types, Classes, and Objects p. 19
2.2 What Is a MATLAB Class? p. 21
2.2.1 Example: Class Requirements p. 21
2.2.1.1 Class Directory p. 22
2.2.1.2 Constructor p. 22
2.2.1.3 The Test Drive p. 24
2.3 Summary p. 26
2.4 Independent Investigations p. 27
Chapter 3 Member Variables and Member Functions p. 29
3.1 Members p. 29
3.2 Accessors and Mutators p. 30
3.2.1 A Short Side Trip to Examine Encapsulation p. 31
3.2.1.1 cShape Variables p. 32
3.2.2 cShape Members p. 33
3.2.2.1 cShape Private Member Variables p. 33
3.2.2.2 cShape Public Interface p. 34
3.2.3 A Short Side Trip to Examine Function Search Priority p. 36
3.2.4 Example Code: Accessors and Mutators, Round 1 p. 37
3.2.4.1 Constructor p. 37
3.2.4.2 Accessors p. 37
3.2.4.3 Mutators p. 38
3.2.4.4 Combining an Accessor and a Mutator p. 39
3.2.4.5 Member Functions p. 40
3.2.5 Standardization p. 40
3.3 The Test Drive p. 41
3.4 Summary p. 42
3.5 Independent Investigations p. 43
Chapter 4 Changing the Rules...in Appearance Only p. 45
4.1 A Special Accessor and a Special Mutator p. 45
4.1.1 A Short Side Trip to Examine Overloading p. 45
4.1.1.1 Superiorto and Inferiorto p. 47
4.1.1.2 The Built-in Function p. 48
4.1.2 Overloading the Operators subsref and subsasgn p. 48
4.1.2.1 Dot-Reference Indexing p. 50
4.1.2.2 subsref Dot-Reference, Attempt 1 p. 51
4.1.2.3 A New Interface Definition p. 52
4.1.2.4 subsref Dot-Reference, Attempt 2: Separating Public and Private Variables p. 53
4.1.2.5 subsref Dot-Reference, Attempt 3: Beyond One-to-One, Public-to-Private p. 53
4.1.2.6 subsref Dot-Reference, Attempt 4: Multiple Indexing Levels p. 55
4.1.2.7 subsref Dot-Reference, Attempt 5: Operator Conversion Anomaly p. 57
4.1.2.8 subsasgn Dot-Reference p. 59
4.1.2.9 Array-Reference Indexing p. 62
4.1.2.10 subsref Array-Reference p. 63
4.1.2.11 subsasgn Array-Reference p. 64
4.1.2.12 Cell-Reference Indexing p. 65
4.1.3 Initial Solution for subsref.m p. 66
4.1.4 Initial Solution for subsasgn.m p. 68
4.1.5 Operator Overload, mtimes p. 69
4.2 The Test Drive p. 70
4.2.1 subsasgn Test Drive 24 p. 70
4.2.2 subsref Test Drive p. 72
4.3 Summary p. 74
4.4 Independent Investigations p. 75
Chapter 5 Displaying an Object's State p. 77
5.1 Displaying Objects p. 77
5.1.1 What Should Be Displayed? p. 77
5.1.2 Standard Structure Display p. 79
5.1.3 Public Member Variable Display p. 80
5.1.3.1 Implementing display.m, Attempt 1 p. 80
5.1.3.2 Implementing display.m, Attempt 2 p. 81
5.2 Developer View p. 83
5.2.1 Implementing display.m with Developer View Options p. 84
5.3 The Test Drive p. 86
5.4 Summary p. 88
5.5 Independent Investigations p. 88
Chapter 6 fieldnames.m p. 91
6.1 Fieldnames p. 91
6.2 Code Development p. 91
6.3 The Test Drive p. 93
6.4 Summary p. 93
6.5 Independent Investigations p. 94
Chapter 7 struct.m p. 95
7.1 Struct p. 95
7.2 Code Development p. 96
7.3 The Test Drive p. 97
7.4 Summary p. 98
7.5 Independent Investigations p. 98
Chapter 8 get.m, set.m p. 99
8.1 Arguments for the Member Functions get and set p. 99
8.1.1 For Developers p. 99
8.1.2 For Clients p. 100
8.1.3 Tab Completion p. 101
8.2 Code Development p. 101
8.2.1 Implementing get and set p. 102
8.2.2 Initial get.m p. 104
8.2.3 Initial set.m p. 107
8.3 The Test Drive p. 110
8.4 Summary p. 111
8.5 Independent Investigations p. 112
Chapter 9 Simplify Using get, set, fieldnames, and struct p. 113
9.1 Improving subsref.m p. 114
9.2 Improving subsasgn.m p. 115
9.3 Improving display.m p. 116
9.4 Test Drive p. 118
9.5 Summary p. 121
9.6 Independent Investigations p. 122
Chapter 10 Drawing a Shape p. 123
10.1 Ready, Set, Draw p. 123
10.1.1 Implementation p. 123
10.1.1.1 Modify the Constructor p. 124
10.1.1.2 Modify fieldnames p. 125
10.1.1.3 Modify get p. 125
10.1.1.4 Modify set p. 128
10.1.1.5 Modify mtimes p. 131
10.1.1.6 Modify reset p. 132
10.1.1.7 Adding Member Function draw p. 132
10.2 Test Drive p. 133
10.3 Summary p. 136
10.4 Independent Investigations p. 137
Part 2 Building a Hierarchy p. 139
Chapter 11 Constructor Redux p. 141
11.1 Specifying Initial Values p. 141
11.1.1 Private Member Functions p. 142
11.2 Generalizing the Constructor p. 143
11.2.1 Constructor Helper/private/ctor_ini.m p. 145
11.2.2 Constructor Helper Example/private/ctor_1.m p. 146
11.3 Test Drive p. 147
11.4 Summary p. 150
11.5 Independent Investigations p. 151
Chapter 12 Constructing Simple Hierarchies with Inheritance p. 153
12.1 Simple Inheritance p. 154
12.1.1 Constructor p. 154
12.1.2 Other Standard Member Functions p. 157
12.1.2.1 Child Class fieldnames p. 161
12.1.2.2 Child Class get p. 162
12.1.2.3 Child Class set p. 165
12.1.3 Parent Slicing in Nonstandard Member Functions p. 167
12.1.3.1 draw.m p. 168
12.1.3.2 mtimes.m p. 168
12.1.3.3 reset.m p. 169
12.2 Test Drive p. 169
12.3 Summary p. 173
12.4 Independent Investigations p. 174
Chapter 13 Object Arrays with Inheritance p. 175
13.1 When Is a cShape Not a cShape? p. 175
13.1.1 Changes to subsasgn p. 176
13.1.2 Vertcat and horzcat p. 177
13.1.3 Test Drive p. 178
13.2 Summary p. 182
13.3 Independent Investigations p. 182
Chapter 14 Child-Class Members p. 183
14.1 Function Redefinition p. 183
14.1.1 /@cStar/private/ctor_ini.m with Private Member Variables p. 184
14.1.2 /@cStar/fieldnames.m with Additional Public Members p. 184
14.1.3 /@cStar/get.m with Additional Public Members p. 185
14.1.4 /@cStar/set.m with Additional Public Members p. 186
14.1.5 /@cStar/draw.m with a Title p. 187
14.2 Test Drive p. 187
14.3 Summary p. 189
14.4 Independent Investigations p. 190
Chapter 15 Constructing Simple Hierarchies with Composition p. 191
15.1 Composition p. 191
15.1.1 The cLineStyle Class p. 192
15.1.1.1 cLineStyle's private/ctor_ini p. 193
15.1.1.2 cLineStyle's fieldnames p. 194
15.1.1.3 cLineStyle's get p. 195
15.1.1.4 cLineStyle's set p. 196
15.1.1.5 cLineStyle's private/ctor_2 p. 197
15.1.2 Using a Primary cShape and a Secondary cLineStyle p. 198
15.1.2.1 Composition Changes to cShape's ctor_ini.m p. 199
15.1.2.2 Adding Line Weight to cShape's fieldnames.m p. 199
15.1.2.3 Composition Changes to cShape's get.m p. 200
15.1.2.4 Composition Changes to cShape's set.m p. 201
15.1.2.5 Composition Changes to cShape's draw.m p. 202
15.1.2.6 Composition Changes to cShape's Other Member Functions p. 202
15.2 lest Drive p. 203
15.3 Summary p. 204
15.4 Independent Investigations p. 206
Chapter 16 General Assignment and Mutator Helper Functions p. 209
16.1 Helper Function Strategy p. 209
16.1.1 Direct-Link Public Variables p. 210
16.1.1.1 Get and subsref p. 210
16.1.1.2 Set and subsasgn p. 211
16.1.2 get and set Helper Functions p. 212
16.1.2.1 Helper functions, get, and set p. 212
16.1.2.2 Final template for get.m p. 213
16.1.2.3 Final Template for set.m p. 217
16.1.2.4 Color Helper Function p. 221
16.1.2.5 The Other Classes and Member Functions p. 222
16.2 Test Drive p. 222
16.3 Summary p. 223
16.4 Independent Investigations p. 224
Chapter 17 Class Wizard p. 225
17.1 File Dependencies p. 226
17.2 Data-Entry Dialog Boxes p. 226
17.2.1 Main Class Wizard Dialog p. 227
17.2.1.1 Header Information Dialog p. 229
17.2.1.2 Parents...Dialog p. 231
17.2.1.3 Private Variable...Dialog p. 232
17.2.1.4 Concealed Variables...Dialog p. 234
17.2.1.5 Public Variables...Dialog p. 235
17.2.1.6 Constructors...Dialog p. 237
17.2.1.7 More...Dialog p. 238
17.2.1.8 Static Variables...Dialog p. 239
17.2.1.9 Private Functions...Dialog p. 240
17.2.1.10 Public Functions...Dialog p. 242
17.2.1.11 File Menu p. 243
17.2.1.12 Data Menu p. 244
17.2.1.13 Build Class Files Button p. 245
17.3 Summary p. 246
17.4 Independent Investigations p. 247
Chapter 18 Class Wizard Versions of the Shape Hierarchy p. 249
18.1 cLineStyle Class Wizard Definition Data p. 249
18.1.1 cLineStyle Header Info p. 250
18.1.2 cLineStyle Private Variables p. 251
18.1.3 cLineStyle Public Variables p. 253
18.1.4 cLineStyle Constructor Functions p. 255
18.1.5 cLineStyle Data Dictionary p. 257
18.1.6 cLineStyle Build Class Files p. 258
18.1.7 cLineStyle Accessor and Mutator Helper Functions p. 259
18.2 cShape Class Wizard Definition Data p. 261
18.2.1 cShape Header Info p. 261
18.2.2 cShape Private Variables p. 261
18.2.3 cShape Concealed Variables p. 262
18.2.4 cShape Public Variables p. 263
18.2.5 cShape Constructor Functions p. 264
18.2.6 cShape Public Functions p. 265
18.2.7 cShape Data Dictionary p. 265
18.2.8 cShape Build Class Files p. 266
18.3 cStar Class Wizard Definition Data p. 268
18.3.1 cStar Parent p. 268
18.3.2 Other cStar Definition Data p. 269
18.4 cDiamond Class Wizard Definition Data p. 271
18.5 Test Drive p. 271
18.6 Summary p. 272
18.7 Independent Investigations p. 275
Part 3 Advanced Strategies p. 277
Chapter 19 Composition and a Simple Container Class p. 279
19.1 Building Containers p. 279
19.2 Container Implementation p. 280
19.2.1 The Standard Framework and the Group of Eight p. 280
19.2.1.1 Container Modifications to fieldnames p. 281
19.2.1.2 Container Modifications to subsref p. 283
19.2.1.3 Container Modifications to subsasgn p. 285
19.2.1.4 Container Modifications to get p. 287
19.2.1.5 Container Modifications to set p. 289
19.2.2 Tailoring Built-in Behavior p. 290
19.2.2.1 Container-Tailored end p. 291
19.2.2.2 Container-Tailored cat, horzcat, vertcat p. 291
19.2.2.3 Container-Tailored length, ndims, reshape, and size p. 293
19.2.3 cShapeArray and numel p. 294
19.2.3.1 Container-Tailored num2cell and mat2cell p. 295
19.2.4 Container Functions That Are Specific to cShape Objects p. 296
19.2.4.1 cShapeArray times and mtimes p. 296
19.2.4.2 cShapeArray draw p. 298
19.2.4.3 cShapeArray reset p. 299
19.3 Test Drive p. 299
19.4 Summary p. 302
19.5 Independent Investigations p. 302
Chapter 20 Static Member Data and Singleton Objects p. 303
20.1 Adding Static Data to Our Framework p. 303
20.1.1 Hooking Static Data into the Group of Eight p. 304
20.1.1.1 Static Variables and the Constructor p. 305
20.1.1.2 Static Variables in get and set p. 305
20.1.1.3 Static Variables in display p. 306
20.1.2 Overloading loadobj and saveobj p. 307
20.1.3 Counting Assignments p. 308
20.2 Singleton Objects p. 308
20.3 Test Drive p. 309
20.4 Summary p. 311
20.5 Independent Investigations p. 312
Chapter 21 Pass-by-Reference Emulation p. 313
21.1 Assignment without Equal p. 313
21.2 Pass-by-Reference Functions p. 314
21.3 Pass-by-Reference Draw p. 315
21.4 Pass-by-Reference Member Variable: View p. 316
21.4.1 Helpers, get, and subsref with Pass-by-Reference Behavior p. 316
21.4.1.1 Pass-by-Reference Behavior in the Helper p. 317
21.4.1.2 Pass-by-Reference Code in get.m p. 318
21.4.1.3 Pass-by-Reference Code in subsref.m p. 321
21.4.2 Other Group-of-Eight Considerations p. 321
21.5 Test Drive p. 322
21.6 Summary p. 324
21.7 Independent Investigations p. 324
Chapter 22 Dot Functions and Functors p. 327
22.1 When Dot-Reference Is Not a Reference p. 327
22.2 When Array-Reference Is Not a Reference p. 332
22.2.1 Functors p. 333
22.2.2 Functor Handles p. 334
22.2.3 Functor feval p. 335
22.2.4 Additional Remarks Concerning Functors p. 335
23.3 Test Drive p. 336
22.4 Summary p. 337
22.5 Independent Investigations p. 337
Chapter 23 Protected Member Variables and Functions p. 339
23.1 How Protected Is Different from Other Visibilities p. 339
23.2 Class Elements for Protected p. 339
23.2.1 Protected Functions and Advanced Function Handle Techniques p. 340
23.2.2 Passing Protected Handles from Parent to Child p. 340
23.2.3 Accessing and Mutating Protected Variables p. 341
23.2.4 Calling Protected Functions p. 343
23.3 Test Drive p. 344
23.4 Summary p. 345
23.5 Independent Investigations p. 346
Chapter 24 Potpourri for $100 p. 347
24.1 A Small Assortment of Useful Commands p. 347
24.1.1 Objectdirectory p. 347
24.1.2 Methods and methodsview p. 347
24.1.3 Functions p. 348
24.2 Other Functions You Might Want to Overload p. 348
24.2.1 Functions for Built-in Types p. 348
24.2.2 subsindex p. 349
24.2.3 Isfield p. 349
24.3 Summary p. 350
24.4 Independent Investigations p. 350
Index p. 351
- 名称
- 类型
- 大小
光盘服务联系方式: 020-38250260 客服QQ:4006604884
云图客服:
用户发送的提问,这种方式就需要有位在线客服来回答用户的问题,这种 就属于对话式的,问题是这种提问是否需要用户登录才能提问
Video Player
×
Audio Player
×
pdf Player
×
亲爱的云图用户,
光盘内的文件都可以直接点击浏览哦
无需下载,在线查阅资料!