Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Руководство_по_C++_CLI.doc
Скачиваний:
4
Добавлен:
01.07.2025
Размер:
8 Мб
Скачать
☆

15. Function Pointers and Delegates 337

15.1 Pointers to Functions 337

15.1.1 Introduction 337

15.1.2 Declaring a Pointer to Function 338

15.1.3 A Function Pointer that Returns a Value 339

15.1.4 A Function Pointer With Arguments 340

15.1.5 Type-Defining a Function Pointer 340

15.1.6 A Pointer to a Function as Argument 341

15.2 Classes and Pointers to Functions 344

15.2.1 A Pointer to Function as a Member Variable 344

15.3 Delegates 346

15.3.1 Introduction 346

15.3.2 Practical Learning: Introducing Delegates 346

15.3.3 Delegate Declaration  348

15.3.4 Practical Learning: Creating a Delegate 349

15.3.5 Techniques of Using a Delegate 349

15.3.6 Practical Learning: Creating a Delegate 352

15.3.7 Delegates Compositions 353

15.3.8 A Delegate With One of More Arguments 353

15.3.9 Practical Learning: Using an Argumentative Delegate 354

15.3.10 A Delegate Passed as Argument 356

16. Introduction to Conditions 359

16.1 Boolean Variables 359

16.1.1 Introduction 359

16.1.2 Practical Learning: Introducing Conditions 359

16.1.3 Declaring a Boolean Variable 364

16.1.4 Retrieving the Value of a Boolean Variable 365

16.1.5 Creating a Boolean Member Variable 365

16.1.6 Boolean Arguments 366

16.1.7 A Boolean Property 367

16.1.8 Practical Learning: Creating a Boolean Property 367

16.2 Enumerations 369

16.2.1 Introduction 369

16.2.2 Indexing the Members of an Enumeration 370

16.2.3 Declaring an Enumeration Variable 372

16.2.4 Global Enumerations 373

16.2.5 Enumerations and Assemblies 374

16.3 Enumerations and Classes 374

16.3.1   An Enumeration as a Member Variable  374

16.3.2 An Enumeration as a Class 376

16.3.4 Practical Learning: Creating Enumerations 378

17. Conditional Operators 379

18. Conditional Statements 401

19. Counting and Looping 422

20. Strings 437

21. Techniques on Using Inheritance 446

22. Variable Scope and Casting 478

23. Templates 490

24. Generics 515

25. Введение в массивы 539

25.1  Описание 539

25.1.1  Определение 539

25.1.2 Создание массива 539

25.1.3 Initializing an Array 539

25.1.4 Type Defining an Array 541

25.2 Arrays and Memory Management  542

25.2.1  Creating a Dynamic Array 542

25.2.2 Cleaning After an Array 543

25.3 Managed Arrays 543

25.3.1 Introduction 543

25.3.2 Practical Learning: Introducing Arrays 544

25.3.3 An Array of Handles 545

25.3.4 Practical Learning: Using an Array of Handles 548

25.4 Arrays and Functions 549

25.4.1  Returning an Array 549

25.4.2 Practical Learning: Returning Arrays 550

25.4.3 Passing an Array as Argument 552

25.4.4 Practical Learning: Passing an Array as Argument 554

26. Multi-Dimensional Arrays 556

26.1   Single and Two-Dimensional Arrays 556

26.1.1 Introduction 556

26.1.2 Practical Learning: Introducing Multi-Dimensional Arrays 557

26.1.3 Two-Dimensional Arrays 558

26.1.4 Multi-Dimensional Arrays 561

26.2 Introduction to Jagged Arrays 566