Microsoft Visual C++.NET Step by Step Version 2003
Microsoft Press,U.S.
978-0-7356-1907-4 (ISBN)
- Keine Verlagsinformationen verfügbar
- Artikel merken
Introduction xv PART 1 GETTING STARTED WITH C++ .NET CHAPTER 1 Hello, C++! 3 What Is a C++ Program? 3 C++ is a strongly typed language. 3 C++ is an efficient language. 4 C++ is an object-oriented language. 4 C++ is based on C (as you might suspect). 4 C++ is a case-sensitive language. 4 Your First C++ Program 4 The main Function 6 C++ Keywords and Identifiers 7 Creating an Executable Program Theory 8 Editing the Program Source Files 8 Compiling the Source Files 8 Linking the Object Files 8 Running and Testing the Program 9 Creating an Executable Program Practice 9 Adding a C++ Source File to the Project 11 Adding C++ Code to the Source File 12 Building the Executable 12 Executing the Program 13 Conclusion 14 CHAPTER 2 Introducing Object-Oriented Programming 15 What Is Object-Oriented Programming? 15 Features of Object-Oriented Programming Languages 16 Encapsulation 16 Inheritance 17 Polymorphism 18 Classes and Objects 19 Benefits to the Developmental Life Cycle 19 A Simple Example 20 CHAPTER 3 Variables and Operators 27 What Is a Variable? 27 The Fundamental Data Types 28 Declaring a Variable 29 Variable Naming 30 Declaring Multiple Variables 30 Assigning Values to Variables 30 Arrays 31 Pointers 32 References 33 Constants 33 Enumerations 34 Typedefs 35 Adding Member Variables to Classes 35 The .NET Framework String Class 36 Operators and Expressions 37 Assignment Operators 37 Arithmetic Operators 37 Relational and Logical Operators 39 Bitwise Operators 40 The Ternary Operator 40 The sizeof Operator 41 Type Casting 41 Operator Precedence and Associativity 41 CHAPTER 4 Using Functions 45 Declaring Function Prototypes 46 Declaring a Simple Function Prototype 46 Declaring Parameters in a Function Prototype 47 Declaring the Return Type in a Function Prototype 48 Declaring Default Values for Function Parameters 48 Defining Function Bodies 49 Defining a Simple Function Body 49 Defining a Function Body That Uses Parameters 50 Defining a Function Body That Returns a Value 52 Calling Functions 53 Calling Functions in the Sample Application 54 Stepping Through the Application with the Debugger 56 Understanding Local and Global Scope 59 Overloading Functions 61 CHAPTER 5 Decision and Loop Statements 65 Making Decisions with the if Statement 65 Performing One-Way Tests 65 Performing Two-Way Tests 69 Performing Multiway Tests 70 Performing Nested Tests 72 Making Decisions with the switch Statement 74 Defining Simple switch Statements 74 Defining Fall-Through in a switch Statement 76 Using Fall-Through in a switch Statement 76 Performing Loops 77 Using while Loops 77 Using for Loops 79 Using do-while Loops 81 Performing Unconditional Jumps 83 PART 2 MORE ABOUT OBJECT-ORIENTED PROGRAMMING CHAPTER 6 More About Classes and Objects 89 Organizing Classes into Header Files and Source Files 90 Defining a Class in a Header File 92 Implementing a Class in a Source File 93 Creating and Destroying Objects 95 Defining Constructors and Destructors 97 Defining Constructors 97 Defining Destructors 99 Defining Class-Wide Members 101 Defining Class-Wide Data Members 103 Defining Class-Wide Member Functions 105 Defining Object Relationships 107 Defining the LoyaltyScheme Class 108 Implementing the LoyaltyScheme Class 108 Creating, Using, and Destroying LoyaltyScheme Objects 110 Testing the Application 112 CHAPTER 7 Controlling Object Lifetimes 117 Traditional C++ Memory Management 117 Creating Objects 117 Deleting Objects 118 Advantages and Disadvantages of Manual Memory Allocation 118 The .NET Approach 120 Finalizers 121 Implementing a Finalizer 123 A Few Points About Finalize 124 Using a Dispose Method 124 Integrating Finalize and Dispose 126 CHAPTER 8 Inheritance 129 Designing an Inheritance Hierarchy 130 Defining a Base Class 131 Defining a Derived Class 133 Accessing Members of the Base Class 135 Creating Objects 138 Overriding Member Functions 140 Defining Sealed Classes 144 Defining and Using Interfaces 144 PART 3 MICROSOFT .NET PROGRAMMING BASICS CHAPTER 9 Value Types 151 Reference Types and Value Types 151 The Need for Value Types 152 Properties of Value Types 153 Structures 153 Creating and Using a Simple Struct 154 Investigating the Structure 155 Differences Between Structures and Classes 156 Implementing Constructors for a Struct 157 Using One Struct Inside Another 157 Copying Structs 160 Enumerations 160 Creating and Using an Enum 161 Using Enums in Programs 162 Avoiding Ambiguity 163 Using Memory Efficiently 163 CHAPTER 10 Operator Overloading 165 What Is Operator Overloading? 165 What Types Need Overloaded Operators? 166 What Can You Overload? 166 Rules of Overloading 167 Overloading Operators in Managed Types 167 Overloading Value Types 167 Overloading Operator Functions 171 Implementing Logical Operators and Equality 173 Implementing Equals 175 Implementing Assignment 177 Implementing Increment and Decrement 179 Overloading Reference Types 180 Calling Overloaded Operators for Reference Types 181 Guidelines for Providing Overloaded Operators 181 CHAPTER 11 Exception Handling 183 What Are Exceptions? 183 How Do Exceptions Work? 185 Exception Types 186 Throwing Exceptions 186 Handling Exceptions 189 Using the try and catch Construct 189 Customizing Exception Handling 191 Using the Exception Hierarchy 192 Using Exceptions with Constructors 193 Nesting and Rethrowing Exceptions 194 The __finally Block 196 The catch( ) Block 197 Creating Your Own Exception Types 198 Using __value Classes 200 Using __try_cast for Dynamic Casting 201 Using Exceptions Across Languages 202 CHAPTER 12 Arrays and Collections 207 Native C++ Arrays 207 Passing Arrays to Functions 210 Initializing Arrays 212 Multidimensional Arrays 212 Dynamic Allocation and Arrays 213 __gc Arrays 215 Using the __gc and __nogc Keywords 216 Arrays and Reference Types 216 Multidimensional __gc Arrays 217 The .NET Array Class 218 Basic Operations on Arrays 219 More Advanced Array Operations 221 Enumerators 224 Other .NET Collection Classes 225 The ArrayList Class 226 Other ArrayList Operations 228 The SortedList Class 228 Other SortedList Operations 230 The StringCollection Class 230 CHAPTER 13 Properties 233 What Are Properties? 233 The Two Kinds of Properties 234 Implementing Scalar Properties 235 Errors in Properties 236 Read-Only and Write-Only Properties 237 Implementing Indexed Properties 239 The Bank Example 239 Implementing the Bank Class 239 Adding the Account Class 242 Creating Account Class Properties 243 Adding Accounts to the Bank Class 244 Implementing the Add and Remove Methods 244 Implementing an Indexed Property to Retrieve Accounts 245 CHAPTER 14 Delegates and Events 249 What Are Delegates? 249 What Do Delegates Do? 250 Defining Delegates 251 Implementing Delegates 251 Calling Static Member Functions Using Delegates 252 Calling Non-Static Member Functions Using Delegates 253 Using Multicast Delegates 253 What Are Events? 257 Implementing an Event Source Class 258 Implementing an Event Receiver 259 Hooking It All Together 261 PART 4 USING THE .NET FRAMEWORK CHAPTER 15 The .NET Framework Class Library 267 What Is the .NET Framework? 267 The Common Language Runtime 268 Intermediate Language 268 The Common Type System 269 The Common Language Specification 269 The .NET Framework Class Library 269 Assemblies 270 Metadata 271 The .NET Framework Namespaces 273 Using Namespaces in C++ Programs 274 The System Namespace 275 The Collections Namespaces 277 The Collections Interfaces 278 The Diagnostics Namespace 278 The IO Namespace 279 The Drawing Namespaces 280 The Forms Namespace 280 The Net Namespaces 281 The Xml Namespaces 282 The Data Namespaces 282 The Web Namespaces 283 CHAPTER 16 Introducing Windows Forms 285 Windows Forms Applications 286 Windows Forms and Designers 286 Windows Forms vs. MFC 287 A Word About ATL 288 The System::Windows::Forms Namespace 288 Creating and Using Forms 289 Creating a Simple Form 289 Using Form Properties 291 Form Relationships 296 Placing Controls on the Form 297 Handling Events 298 Using Controls 300 Label 301 Button 303 CheckBox and RadioButton 304 Using Radio Buttons as a Group 305 ListBox and ComboBox 305 TextBox 310 Using Menus 314 More About Menus 317 Displaying a Context Menu 317 CHAPTER 17 Dialog Boxes and Controls 319 Using Dialog Boxes 319 The DialogResult Property 323 Using Data with Dialog Boxes 324 Setting Tab Ordering 327 Using Common Dialog Boxes 327 More About Controls 329 Using the TreeView Control 331 Adding Directory Browsing 335 Using the ListView Control 340 Displaying Directory Details 343 Using Splitters 347 Using Toolbars 348 Using Status Bars 353 CHAPTER 18 Graphical Output 357 Graphics with GDI+ 357 The System::Drawing Namespaces 358 The Graphics Class 359 Creating Graphics Objects 359 Drawing Objects 360 Standard Pens and Brushes 361 Drawing Operations 361 Paint Events 365 Using Color 368 Using Fonts 369 Handling Images 372 Printing 373 CHAPTER 19 Working with Files 379 The System::IO Namespace 379 Text I/O Using Readers and Writers 381 Using TextWriter 381 The FileStream Class 383 Using TextReader 385 Working with Files and Directories 387 Getting Information About Files and Directories 387 Binary I/O 396 The BinaryWriter Class 396 The BinaryReader Class 397 PART 5 DATA ACCESS CHAPTER 20 Reading and Writing XML 405 XML and .NET 405 The .NET XML Namespaces 406 The XML Processing Classes 406 Parsing XML with XmlTextReader 407 Verifying Well-Formed XML 413 Handling Attributes 414 Parsing XML with Validation 414 Writing XML Using XmlTextWriter 419 Using XmlDocument 424 The XmlNode Class 427 CHAPTER 21 Transforming XML 435 Using XSL to Transform XML 435 Using XPath 437 The XPathNavigator Class 437 Using XPathNavigator 439 Using XPath with XPathNavigator 442 Using XSL 444 CHAPTER 22 Using ADO.NET 451 What Is ADO.NET? 452 ADO.NET Data Providers 452 ADO.NET Namespaces 452 ADO.NET Assemblies 453 Creating a Connected Application 454 Connecting to a Database 454 Creating and Executing a Command 456 Executing a Command That Modifies Data 457 Executing Queries and Processing the Results 458 Creating a Disconnected Application 459 Creating the Form 461 Creating and Configuring the Data Adapter 462 Creating and Filling the DataSet 465 PART 6 CREATING DISTRIBUTED APPLICATIONS CHAPTER 23 Building a Web Service 471 What Are Web Services? 471 A Web Service Scenario 472 Web Services and the Future 472 Web Service Architecture 473 Data Formats and Protocols 473 Web Service Description 474 Web Service Discovery 474 The Web Services Namespaces 475 Creating a Simple Web Service 476 Using the Web Service from a Browser 479 Using the Web Service from Code 480 Debugging Web Services 484 If You re Not Using Visual Studio .NET 484 CHAPTER 24 Introduction to ATL Server 487 What Is ATL Server? 487 Coding with ATL Server 489 Creating Web-Based Applications Using ATL Server 490 ATL Server Architecture 490 More About Server Response Files 492 Writing a Web Application Using ATL Server 493 Using the Web Application from a Browser 497 Creating Web Services Using ATL 497 Writing a Web Service in ATL 497 Creating the Code Skeleton 497 Modifying the Interface 498 Providing the Implementation 500 Using ATL Server 502 PART 7 ADVANCED TOPICS CHAPTER 25 Working with Unmanaged Code 507 Managed vs. Unmanaged Code 507 Mixed Classes 508 GCHandle 509 Pinning and Boxing 511 Pinning Pointers 512 Boxing and Unboxing 513 Boxing 513 Unboxing 514 Using PInvoke to Call Functions in the Win32 API 517 The DllImportAttribute Class 520 Passing Structures 522 CHAPTER 26 Attributes and Reflection 527 Metadata and Attributes 527 Using Predefined Attributes 530 The AssemblyInfo.cpp File 530 Using the Predefined Attribute Classes 531 Defining Your Own Attributes 536 Attribute Class Properties 537 Design Criteria for Attribute Classes 538 Writing a Custom Attribute 538 Using Reflection to Get Attribute Data 542 The Type Class 542 Accessing Standard Attributes 544 Accessing Custom Attribute Data 545 CHAPTER 27 Living with COM 549 COM Components and COM Interop 549 Using COM Components from .NET Code 550 How Do RCWs Work? 550 Creating and Using RCWs 552 Handling COM Errors 554 Late Binding to COM Objects 555 Using ActiveX Controls in Windows Forms Projects 557 Calling Control Methods 559 Using .NET Components as COM Components 560 What must .NET types implement to be used as COM objects? 561 INDEX 563
Erscheint lt. Verlag | 23.4.2003 |
---|---|
Reihe/Serie | Step by Step |
Zusatzinfo | Illustrations |
Verlagsort | Redmond |
Sprache | englisch |
Maße | 180 x 230 mm |
Gewicht | 1179 g |
Themenwelt | Informatik ► Programmiersprachen / -werkzeuge ► C / C++ |
ISBN-10 | 0-7356-1907-7 / 0735619077 |
ISBN-13 | 978-0-7356-1907-4 / 9780735619074 |
Zustand | Neuware |
Haben Sie eine Frage zum Produkt? |