100% found this document useful (5 votes)
27 views

(eBook PDF) C++ How to Program 10th Edition by Paul J. Deitel pdf download

The document provides links to download various editions of programming eBooks by Paul J. Deitel, including titles on C++, C#, and Java. It also contains information about trademarks and the structure of the book's content, which covers fundamental programming concepts and techniques. Additionally, it mentions the availability of supplementary materials on a companion website.

Uploaded by

dedhemirzac
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (5 votes)
27 views

(eBook PDF) C++ How to Program 10th Edition by Paul J. Deitel pdf download

The document provides links to download various editions of programming eBooks by Paul J. Deitel, including titles on C++, C#, and Java. It also contains information about trademarks and the structure of the book's content, which covers fundamental programming concepts and techniques. Additionally, it mentions the availability of supplementary materials on a companion website.

Uploaded by

dedhemirzac
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

(eBook PDF) C++ How to Program 10th Edition by

Paul J. Deitel pdf download

https://ebooksecure.com/product/ebook-pdf-c-how-to-program-10th-
edition-by-paul-j-deitel/

Download more ebook from https://ebooksecure.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebooksecure.com
to discover even more!

(eBook PDF) Visual C# How to Program 6th Edition by


Paul J. Deitel

http://ebooksecure.com/product/ebook-pdf-visual-c-how-to-
program-6th-edition-by-paul-j-deitel/

C How to Program 9th Edition Deitel Paul - eBook PDF

https://ebooksecure.com/download/c-how-to-program-ebook-pdf/

(eBook PDF) C How to Program, Global Edition 8th by


Paul Deitel

http://ebooksecure.com/product/ebook-pdf-c-how-to-program-global-
edition-8th-by-paul-deitel/

C How to Program, 9th Global Edition Deitel Paul -


eBook PDF

https://ebooksecure.com/download/c-how-to-program-9th-global-
edition-ebook-pdf/
(eBook PDF) Java How to Program, Early Objects 11th
Edition by Paul J. Deitel

http://ebooksecure.com/product/ebook-pdf-java-how-to-program-
early-objects-11th-edition-by-paul-j-deitel/

C++ How to Program: An Objects-Natural Approach, 11e


11th Edition Paul Deitel - eBook PDF

https://ebooksecure.com/download/c-how-to-program-an-objects-
natural-approach-11e-ebook-pdf/

C How to Program: With Case Studies in Applications and


Systems Programming, Global Edition Paul Deitel - eBook
PDF

https://ebooksecure.com/download/c-how-to-program-with-case-
studies-in-applications-and-systems-programming-global-edition-
ebook-pdf/

(eBook PDF) Java How To Program (Early Objects) 10th

http://ebooksecure.com/product/ebook-pdf-java-how-to-program-
early-objects-10th/

C++ How to Program Early Objects Version 9th Edition


(eBook PDF)

http://ebooksecure.com/product/c-how-to-program-early-objects-
version-9th-edition-ebook-pdf/
Trademarks
DEITEL and the double-thumbs-up bug are registered trademarks of Deitel and Associates, Inc.
Carnegie Mellon Software Engineering Institute™ is a trademark of Carnegie Mellon University.
CERT® is registered in the U.S. Patent and Trademark Office by Carnegie Mellon University.
UNIX is a registered trademark of The Open Group.
Microsoft and/or its respective suppliers make no representations about the suitability of the information
contained in the documents and related graphics published as part of the services for any purpose. All
such documents and related graphics are provided “as is” without warranty of any kind. Microsoft and/
or its respective suppliers hereby disclaim all warranties and conditions with regard to this information,
including all warranties and conditions of merchantability, whether express, implied or statutory, fitness
for a particular purpose, title and non-infringement. In no event shall Microsoft and/or its respective sup-
pliers be liable for any special, indirect or consequential damages or any damages whatsoever resulting
from loss of use, data or profits, whether in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of information available from the services.
The documents and related graphics contained herein could include technical inaccuracies or typograph-
ical errors. Changes are periodically added to the information herein. Microsoft and/or its respective sup-
pliers may make improvements and/or changes in the product(s) and/or the program(s) described herein
at any time. Partial screen shots may be viewed in full within the software version specified.
Microsoft® and Windows® are registered trademarks of the Microsoft Corporation in the U.S.A. and
other countries. Screen shots and icons reprinted with permission from the Microsoft Corporation. This
book is not sponsored or endorsed by or affiliated with the Microsoft Corporation.

Throughout this book, trademarks are used. Rather than put a trademark symbol in every occurrence of
a trademarked name, we state that we are using the names in an editorial fashion only and to the benefit
of the trademark owner, with no intention of infringement of the trademark.
Contents
Chapters 23–26 and Appendices F–J are PDF documents posted online at the book’s
Companion Website, which is accessible from
http://www.pearsonhighered.com/deitel

See the inside front cover for more information.

Preface xxiii

Before You Begin xxxix

1 Introduction to Computers and C++ 1


1.1 Introduction 2
1.2 Computers and the Internet in Industry and Research 3
1.3 Hardware and Software 5
1.3.1 Moore’s Law 5
1.3.2 Computer Organization 6
1.4 Data Hierarchy 7
1.5 Machine Languages, Assembly Languages and High-Level Languages 10
1.6 C and C++ 11
1.7 Programming Languages 12
1.8 Introduction to Object Technology 14
1.9 Typical C++ Development Environment 17
1.10 Test-Driving a C++ Application 20
1.10.1 Compiling and Running an Application in Visual Studio 2015
for Windows 20
1.10.2 Compiling and Running Using GNU C++ on Linux 25
1.10.3 Compiling and Running with Xcode on Mac OS X 27
1.11 Operating Systems 32
1.11.1 Windows—A Proprietary Operating System 32
1.11.2 Linux—An Open-Source Operating System 32
1.11.3 Apple’s OS X; Apple’s iOS for iPhone®, iPad® and iPod Touch®
Devices 33
1.11.4 Google’s Android 33
1.12 The Internet and the World Wide Web 34
1.13 Some Key Software Development Terminology 36
1.14 C++11 and C++14: The Latest C++ Versions 38
viii Contents

1.15 Boost C++ Libraries 39


1.16 Keeping Up to Date with Information Technologies 39

2 Introduction to C++ Programming,


Input/Output and Operators 44
2.1 Introduction 45
2.2 First Program in C++: Printing a Line of Text 45
2.3 Modifying Our First C++ Program 49
2.4 Another C++ Program: Adding Integers 50
2.5 Memory Concepts 54
2.6 Arithmetic 55
2.7 Decision Making: Equality and Relational Operators 59
2.8 Wrap-Up 63

3 Introduction to Classes, Objects,


Member Functions and Strings 73
3.1 Introduction 74
3.2 Test-Driving an Account Object 75
3.2.1 Instantiating an Object 75
3.2.2 Headers and Source-Code Files 76
3.2.3 Calling Class Account’s getName Member Function 76
3.2.4 Inputting a string with getline 77
3.2.5 Calling Class Account’s setName Member Function 77
3.3 Account Class with a Data Member and Set and Get Member Functions 78
3.3.1 Account Class Definition 78
3.3.2 Keyword class and the Class Body 79
3.3.3 Data Member name of Type string 79
3.3.4 setName Member Function 80
3.3.5 getName Member Function 82
3.3.6 Access Specifiers private and public 82
3.3.7 Account UML Class Diagram 83
3.4 Account Class: Initializing Objects with Constructors 84
3.4.1 Defining an Account Constructor for Custom Object Initialization 85
3.4.2 Initializing Account Objects When They’re Created 86
3.4.3 Account UML Class Diagram with a Constructor 88
3.5 Software Engineering with Set and Get Member Functions 88
3.6 Account Class with a Balance; Data Validation 89
3.6.1 Data Member balance 89
3.6.2 Two-Parameter Constructor with Validation 91
3.6.3 deposit Member Function with Validation 91
3.6.4 getBalance Member Function 91
3.6.5 Manipulating Account Objects with Balances 92
3.6.6 Account UML Class Diagram with a Balance and Member
Functions deposit and getBalance 94
3.7 Wrap-Up 94
Contents ix

4 Algorithm Development and


Control Statements: Part 1 103
4.1 Introduction 104
4.2 Algorithms 105
4.3 Pseudocode 105
4.4 Control Structures 106
4.4.1 Sequence Structure 106
4.4.2 Selection Statements 108
4.4.3 Iteration Statements 108
4.4.4 Summary of Control Statements 109
4.5 if Single-Selection Statement 109
4.6 if…else Double-Selection Statement 110
4.6.1 Nested if…else Statements 111
4.6.2 Dangling-else Problem 113
4.6.3 Blocks 113
4.6.4 Conditional Operator (?:) 114
4.7 Student Class: Nested if…else Statements 115
4.8 while Iteration Statement 117
4.9 Formulating Algorithms: Counter-Controlled Iteration 119
4.9.1 Pseudocode Algorithm with Counter-Controlled Iteration 119
4.9.2 Implementing Counter-Controlled Iteration 120
4.9.3 Notes on Integer Division and Truncation 122
4.9.4 Arithmetic Overflow 122
4.9.5 Input Validation 123
4.10 Formulating Algorithms: Sentinel-Controlled Iteration 123
4.10.1 Top-Down, Stepwise Refinement: The Top and First Refinement 124
4.10.2 Proceeding to the Second Refinement 124
4.10.3 Implementing Sentinel-Controlled Iteration 126
4.10.4 Converting Between Fundamental Types Explicitly and Implicitly 129
4.10.5 Formatting Floating-Point Numbers 130
4.10.6 Unsigned Integers and User Input 130
4.11 Formulating Algorithms: Nested Control Statements 131
4.11.1 Problem Statement 131
4.11.2 Top-Down, Stepwise Refinement: Pseudocode Representation
of the Top 132
4.11.3 Top-Down, Stepwise Refinement: First Refinement 132
4.11.4 Top-Down, Stepwise Refinement: Second Refinement 132
4.11.5 Complete Second Refinement of the Pseudocode 133
4.11.6 Program That Implements the Pseudocode Algorithm 134
4.11.7 Preventing Narrowing Conversions with List Initialization 135
4.12 Compound Assignment Operators 136
4.13 Increment and Decrement Operators 137
4.14 Fundamental Types Are Not Portable 140
4.15 Wrap-Up 140
x Contents

5 Control Statements: Part 2; Logical Operators 159


5.1 Introduction 160
5.2 Essentials of Counter-Controlled Iteration 160
5.3 for Iteration Statement 161
5.4 Examples Using the for Statement 165
5.5 Application: Summing Even Integers 166
5.6 Application: Compound-Interest Calculations 167
5.7 Case Study: Integer-Based Monetary Calculations with
Class DollarAmount 171
5.7.1 Demonstrating Class DollarAmount 172
5.7.2 Class DollarAmount 175
5.8 do…while Iteration Statement 179
5.9 switch Multiple-Selection Statement 180
5.10 break and continue Statements 186
5.10.1 break Statement 186
5.10.2 continue Statement 187
5.11 Logical Operators 188
5.11.1 Logical AND (&&) Operator 188
5.11.2 Logical OR (||) Operator 189
5.11.3 Short-Circuit Evaluation 190
5.11.4 Logical Negation (!) Operator 190
5.11.5 Logical Operators Example 191
5.12 Confusing the Equality (==) and Assignment (=) Operators 192
5.13 Structured-Programming Summary 194
5.14 Wrap-Up 199

6 Functions and an Introduction to Recursion 211


6.1 Introduction 212
6.2 Program Components in C++ 213
6.3 Math Library Functions 214
6.4 Function Prototypes 215
6.5 Function-Prototype and Argument-Coercion Notes 218
6.5.1 Function Signatures and Function Prototypes 219
6.5.2 Argument Coercion 219
6.5.3 Argument-Promotion Rules and Implicit Conversions 219
6.6 C++ Standard Library Headers 220
6.7 Case Study: Random-Number Generation 222
6.7.1 Rolling a Six-Sided Die 223
6.7.2 Rolling a Six-Sided Die 60,000,000 Times 224
6.7.3 Randomizing the Random-Number Generator with srand 225
6.7.4 Seeding the Random-Number Generator with the Current Time 227
6.7.5 Scaling and Shifting Random Numbers 227
6.8 Case Study: Game of Chance; Introducing Scoped enums 228
6.9 C++11 Random Numbers 232
6.10 Scope Rules 233
Contents xi

6.11 Function-Call Stack and Activation Records 237


6.12 Inline Functions 241
6.13 References and Reference Parameters 242
6.14 Default Arguments 245
6.15 Unary Scope Resolution Operator 247
6.16 Function Overloading 248
6.17 Function Templates 251
6.18 Recursion 254
6.19 Example Using Recursion: Fibonacci Series 257
6.20 Recursion vs. Iteration 260
6.21 Wrap-Up 263

7 Class Templates array and vector;


Catching Exceptions 283
7.1 Introduction 284
7.2 arrays 284
7.3 Declaring arrays 286
7.4 Examples Using arrays 286
7.4.1 Declaring an array and Using a Loop to Initialize the array’s
Elements 287
7.4.2 Initializing an array in a Declaration with an Initializer List 288
7.4.3 Specifying an array’s Size with a Constant Variable and Setting
array Elements with Calculations 289
7.4.4 Summing the Elements of an array 290
7.4.5 Using a Bar Chart to Display array Data Graphically 291
7.4.6 Using the Elements of an array as Counters 292
7.4.7 Using arrays to Summarize Survey Results 293
7.4.8 Static Local arrays and Automatic Local arrays 296
7.5 Range-Based for Statement 298
7.6 Case Study: Class GradeBook Using an array to Store Grades 300
7.7 Sorting and Searching arrays 306
7.7.1 Sorting 306
7.7.2 Searching 306
7.7.3 Demonstrating Functions sort and binary_search 306
7.8 Multidimensional arrays 307
7.9 Case Study: Class GradeBook Using a Two-Dimensional array 311
7.10 Introduction to C++ Standard Library Class Template vector 317
7.11 Wrap-Up 323

8 Pointers 339
8.1 Introduction 340
8.2 Pointer Variable Declarations and Initialization 341
8.2.1 Declaring Pointers 341
8.2.2 Initializing Pointers 342
8.2.3 Null Pointers Prior to C++11 342
xii Contents

8.3 Pointer Operators 342


8.3.1 Address (&) Operator 342
8.3.2 Indirection (*) Operator 343
8.3.3 Using the Address (&) and Indirection (*) Operators 344
8.4 Pass-by-Reference with Pointers 345
8.5 Built-In Arrays 349
8.5.1 Declaring and Accessing a Built-In Array 349
8.5.2 Initializing Built-In Arrays 350
8.5.3 Passing Built-In Arrays to Functions 350
8.5.4 Declaring Built-In Array Parameters 351
8.5.5 C++11: Standard Library Functions begin and end 351
8.5.6 Built-In Array Limitations 351
8.5.7 Built-In Arrays Sometimes Are Required 352
8.6 Using const with Pointers 352
8.6.1 Nonconstant Pointer to Nonconstant Data 353
8.6.2 Nonconstant Pointer to Constant Data 353
8.6.3 Constant Pointer to Nonconstant Data 354
8.6.4 Constant Pointer to Constant Data 355
8.7 sizeof Operator 356
8.8 Pointer Expressions and Pointer Arithmetic 358
8.8.1 Adding Integers to and Subtracting Integers from Pointers 359
8.8.2 Subtracting Pointers 360
8.8.3 Pointer Assignment 361
8.8.4 Cannot Dereference a void* 361
8.8.5 Comparing Pointers 361
8.9 Relationship Between Pointers and Built-In Arrays 361
8.9.1 Pointer/Offset Notation 362
8.9.2 Pointer/Offset Notation with the Built-In Array’s Name
as the Pointer 362
8.9.3 Pointer/Subscript Notation 362
8.9.4 Demonstrating the Relationship Between Pointers and
Built-In Arrays 363
8.10 Pointer-Based Strings (Optional) 364
8.11 Note About Smart Pointers 367
8.12 Wrap-Up 367

9 Classes: A Deeper Look 385


9.1 Introduction 386
9.2 Time Class Case Study: Separating Interface from Implementation 387
9.2.1 Interface of a Class 388
9.2.2 Separating the Interface from the Implementation 388
9.2.3 Time Class Definition 388
9.2.4 Time Class Member Functions 390
9.2.5 Scope Resolution Operator (::) 391
9.2.6 Including the Class Header in the Source-Code File 391
Contents xiii

9.2.7 Time Class Member Function setTime and Throwing Exceptions 392
9.2.8 Time Class Member Function toUniversalString and
String Stream Processing 392
9.2.9 Time Class Member Function toStandardString 393
9.2.10 Implicitly Inlining Member Functions 393
9.2.11 Member Functions vs. Global Functions 393
9.2.12 Using Class Time 394
9.2.13 Object Size 396
9.3 Compilation and Linking Process 396
9.4 Class Scope and Accessing Class Members 398
9.5 Access Functions and Utility Functions 399
9.6 Time Class Case Study: Constructors with Default Arguments 399
9.6.1 Constructors with Default Arguments 399
9.6.2 Overloaded Constructors and C++11 Delegating Constructors 404
9.7 Destructors 405
9.8 When Constructors and Destructors Are Called 405
9.8.1 Constructors and Destructors for Objects in Global Scope 406
9.8.2 Constructors and Destructors for Non-static Local Objects 406
9.8.3 Constructors and Destructors for static Local Objects 406
9.8.4 Demonstrating When Constructors and Destructors Are Called 406
9.9 Time Class Case Study: A Subtle Trap—Returning a Reference or a
Pointer to a private Data Member 409
9.10 Default Memberwise Assignment 411
9.11 const Objects and const Member Functions 413
9.12 Composition: Objects as Members of Classes 415
9.13 friend Functions and friend Classes 421
9.14 Using the this Pointer 423
9.14.1 Implicitly and Explicitly Using the this Pointer to Access an
Object’s Data Members 424
9.14.2 Using the this Pointer to Enable Cascaded Function Calls 425
9.15 static Class Members 429
9.15.1 Motivating Classwide Data 429
9.15.2 Scope and Initialization of static Data Members 429
9.15.3 Accessing static Data Members 430
9.15.4 Demonstrating static Data Members 430
9.16 Wrap-Up 433

10 Operator Overloading; Class string 447


10.1 Introduction 448
10.2 Using the Overloaded Operators of Standard Library Class string 449
10.3 Fundamentals of Operator Overloading 453
10.3.1 Operator Overloading Is Not Automatic 453
10.3.2 Operators That You Do Not Have to Overload 453
10.3.3 Operators That Cannot Be Overloaded 454
10.3.4 Rules and Restrictions on Operator Overloading 454
xiv Contents

10.4 Overloading Binary Operators 455


10.5 Overloading the Binary Stream Insertion and Stream Extraction Operators 455
10.6 Overloading Unary Operators 459
10.7 Overloading the Increment and Decrement Operators 460
10.8 Case Study: A Date Class 461
10.9 Dynamic Memory Management 466
10.10 Case Study: Array Class 468
10.10.1 Using the Array Class 469
10.10.2 Array Class Definition 473
10.11 Operators as Member vs. Non-Member Functions 480
10.12 Converting Between Types 481
10.13 explicit Constructors and Conversion Operators 482
10.14 Overloading the Function Call Operator () 485
10.15 Wrap-Up 485

11 Object-Oriented Programming: Inheritance 497


11.1 Introduction 498
11.2 Base Classes and Derived Classes 499
11.2.1 CommunityMember Class Hierarchy 499
11.2.2 Shape Class Hierarchy 500
11.3 Relationship between Base and Derived Classes 501
11.3.1 Creating and Using a CommissionEmployee Class 501
11.3.2 Creating a BasePlusCommissionEmployee Class Without
Using Inheritance 506
11.3.3 Creating a CommissionEmployee–BasePlusCommissionEmployee
Inheritance Hierarchy 511
11.3.4 CommissionEmployee–BasePlusCommissionEmployee Inheritance
Hierarchy Using protected Data 515
11.3.5 CommissionEmployee–BasePlusCommissionEmployee Inheritance
Hierarchy Using private Data 519
11.4 Constructors and Destructors in Derived Classes 523
11.5 public, protected and private Inheritance 525
11.6 Wrap-Up 526

12 Object-Oriented Programming: Polymorphism 531


12.1 Introduction 532
12.2 Introduction to Polymorphism: Polymorphic Video Game 533
12.3 Relationships Among Objects in an Inheritance Hierarchy 534
12.3.1 Invoking Base-Class Functions from Derived-Class Objects 534
12.3.2 Aiming Derived-Class Pointers at Base-Class Objects 537
12.3.3 Derived-Class Member-Function Calls via Base-Class Pointers 538
12.4 Virtual Functions and Virtual Destructors 540
12.4.1 Why virtual Functions Are Useful 540
12.4.2 Declaring virtual Functions 540
Contents xv

12.4.3 Invoking a virtual Function Through a Base-Class Pointer


or Reference 541
12.4.4 Invoking a virtual Function Through an Object’s Name 541
12.4.5 virtual Functions in the CommissionEmployee Hierarchy 541
12.4.6 virtual Destructors 546
12.4.7 C++11: final Member Functions and Classes 546
12.5 Type Fields and switch Statements 547
12.6 Abstract Classes and Pure virtual Functions 547
12.6.1 Pure virtual Functions 548
12.6.2 Device Drivers: Polymorphism in Operating Systems 549
12.7 Case Study: Payroll System Using Polymorphism 549
12.7.1 Creating Abstract Base Class Employee 550
12.7.2 Creating Concrete Derived Class SalariedEmployee 553
12.7.3 Creating Concrete Derived Class CommissionEmployee 556
12.7.4 Creating Indirect Concrete Derived Class
BasePlusCommissionEmployee 558
12.7.5 Demonstrating Polymorphic Processing 560
12.8 (Optional) Polymorphism, Virtual Functions and Dynamic Binding
“Under the Hood” 563
12.9 Case Study: Payroll System Using Polymorphism and Runtime Type
Information with Downcasting, dynamic_cast, typeid and type_info 567
12.10 Wrap-Up 570

13 Stream Input/Output: A Deeper Look 577


13.1 Introduction 578
13.2 Streams 579
13.2.1 Classic Streams vs. Standard Streams 579
13.2.2 iostream Library Headers 580
13.2.3 Stream Input/Output Classes and Objects 580
13.3 Stream Output 581
13.3.1 Output of char* Variables 581
13.3.2 Character Output Using Member Function put 582
13.4 Stream Input 582
13.4.1 get and getline Member Functions 583
13.4.2 istream Member Functions peek, putback and ignore 586
13.4.3 Type-Safe I/O 586
13.5 Unformatted I/O Using read, write and gcount 586
13.6 Stream Manipulators: A Deeper Look 587
13.6.1 Integral Stream Base: dec, oct, hex and setbase 588
13.6.2 Floating-Point Precision (precision, setprecision) 588
13.6.3 Field Width (width, setw) 590
13.6.4 User-Defined Output Stream Manipulators 591
13.7 Stream Format States and Stream Manipulators 592
13.7.1 Trailing Zeros and Decimal Points (showpoint) 593
13.7.2 Justification (left, right and internal) 594
xvi Contents

13.7.3 Padding (fill, setfill) 595


13.7.4 Integral Stream Base (dec, oct, hex, showbase) 597
13.7.5 Floating-Point Numbers; Scientific and Fixed Notation
(scientific, fixed) 597
13.7.6 Uppercase/Lowercase Control (uppercase) 598
13.7.7 Specifying Boolean Format (boolalpha) 599
13.7.8 Setting and Resetting the Format State via Member
Function flags 600
13.8 Stream Error States 601
13.9 Tying an Output Stream to an Input Stream 604
13.10 Wrap-Up 605

14 File Processing 615


14.1 Introduction 616
14.2 Files and Streams 616
14.3 Creating a Sequential File 617
14.3.1 Opening a File 618
14.3.2 Opening a File via the open Member Function 619
14.3.3 Testing Whether a File Was Opened Successfully 619
14.3.4 Overloaded bool Operator 620
14.3.5 Processing Data 620
14.3.6 Closing a File 620
14.3.7 Sample Execution 621
14.4 Reading Data from a Sequential File 621
14.4.1 Opening a File for Input 622
14.4.2 Reading from the File 622
14.4.3 File-Position Pointers 622
14.4.4 Case Study: Credit Inquiry Program 623
14.5 C++14: Reading and Writing Quoted Text 626
14.6 Updating Sequential Files 627
14.7 Random-Access Files 628
14.8 Creating a Random-Access File 629
14.8.1 Writing Bytes with ostream Member Function write 629
14.8.2 Converting Between Pointer Types with the
reinterpret_cast Operator 629
14.8.3 Credit-Processing Program 630
14.8.4 Opening a File for Output in Binary Mode 633
14.9 Writing Data Randomly to a Random-Access File 633
14.9.1 Opening a File for Input and Output in Binary Mode 635
14.9.2 Positioning the File-Position Pointer 635
14.10 Reading from a Random-Access File Sequentially 635
14.11 Case Study: A Transaction-Processing Program 637
14.12 Object Serialization 643
14.13 Wrap-Up 644
Contents xvii

15 Standard Library Containers and Iterators 655


15.1 Introduction 656
15.2 Introduction to Containers 658
15.3 Introduction to Iterators 662
15.4 Introduction to Algorithms 667
15.5 Sequence Containers 667
15.5.1 vector Sequence Container 668
15.5.2 list Sequence Container 675
15.5.3 deque Sequence Container 680
15.6 Associative Containers 681
15.6.1 multiset Associative Container 682
15.6.2 set Associative Container 685
15.6.3 multimap Associative Container 687
15.6.4 map Associative Container 689
15.7 Container Adapters 690
15.7.1 stack Adapter 691
15.7.2 queue Adapter 693
15.7.3 priority_queue Adapter 694
15.8 Class bitset 695
15.9 Wrap-Up 697

16 Standard Library Algorithms 707


16.1 Introduction 708
16.2 Minimum Iterator Requirements 708
16.3 Lambda Expressions 710
16.3.1 Algorithm for_each 711
16.3.2 Lambda with an Empty Introducer 711
16.3.3 Lambda with a Nonempty Introducer—Capturing Local Variables 712
16.3.4 Lambda Return Types 712
16.4 Algorithms 712
16.4.1 fill, fill_n, generate and generate_n 712
16.4.2 equal, mismatch and lexicographical_compare 715
16.4.3 remove, remove_if, remove_copy and remove_copy_if 718
16.4.4 replace, replace_if, replace_copy and replace_copy_if 721
16.4.5 Mathematical Algorithms 723
16.4.6 Basic Searching and Sorting Algorithms 726
16.4.7 swap, iter_swap and swap_ranges 731
16.4.8 copy_backward, merge, unique and reverse 732
16.4.9 inplace_merge, unique_copy and reverse_copy 735
16.4.10 Set Operations 737
16.4.11 lower_bound, upper_bound and equal_range 740
16.4.12 min, max, minmax and minmax_element 742
16.5 Function Objects 744
16.6 Standard Library Algorithm Summary 747
16.7 Wrap-Up 749
xviii Contents

17 Exception Handling: A Deeper Look 757


17.1 Introduction 758
17.2 Exception-Handling Flow of Control; Defining an Exception Class 759
17.2.1 Defining an Exception Class to Represent the Type of Problem
That Might Occur 759
17.2.2 Demonstrating Exception Handling 760
17.2.3 Enclosing Code in a try Block 761
17.2.4 Defining a catch Handler to Process a DivideByZeroException 762
17.2.5 Termination Model of Exception Handling 762
17.2.6 Flow of Program Control When the User Enters a Nonzero
Denominator 763
17.2.7 Flow of Program Control When the User Enters a Denominator
of Zero 763
17.3 Rethrowing an Exception 764
17.4 Stack Unwinding 766
17.5 When to Use Exception Handling 767
17.6 noexcept: Declaring Functions That Do Not Throw Exceptions 768
17.7 Constructors, Destructors and Exception Handling 768
17.7.1 Destructors Called Due to Exceptions 768
17.7.2 Initializing Local Objects to Acquire Resources 769
17.8 Processing new Failures 769
17.8.1 new Throwing bad_alloc on Failure 769
17.8.2 new Returning nullptr on Failure 770
17.8.3 Handling new Failures Using Function set_new_handler 771
17.9 Class unique_ptr and Dynamic Memory Allocation 772
17.9.1 unique_ptr Ownership 774
17.9.2 unique_ptr to a Built-In Array 775
17.10 Standard Library Exception Hierarchy 775
17.11 Wrap-Up 777

18 Introduction to Custom Templates 783


18.1 Introduction 784
18.2 Class Templates 785
18.2.1 Creating Class Template Stack<T> 786
18.2.2 Class Template Stack<T>’s Data Representation 787
18.2.3 Class Template Stack<T>’s Member Functions 787
18.2.4 Declaring a Class Template’s Member Functions Outside the
Class Template Definition 788
18.2.5 Testing Class Template Stack<T> 788
18.3 Function Template to Manipulate a Class-Template Specialization Object 790
18.4 Nontype Parameters 792
18.5 Default Arguments for Template Type Parameters 792
18.6 Overloading Function Templates 793
18.7 Wrap-Up 793
Contents xix

19 Custom Templatized Data Structures 797


19.1 Introduction 798
19.1.1 Always Prefer the Standard Library’s Containers, Iterators
and Algorithms, if Possible 799
19.1.2 Special Section: Building Your Own Compiler 799
19.2 Self-Referential Classes 799
19.3 Linked Lists 800
19.3.1 Testing Our Linked List Implementation 802
19.3.2 Class Template ListNode 805
19.3.3 Class Template List 806
19.3.4 Member Function insertAtFront 809
19.3.5 Member Function insertAtBack 810
19.3.6 Member Function removeFromFront 810
19.3.7 Member Function removeFromBack 811
19.3.8 Member Function print 812
19.3.9 Circular Linked Lists and Double Linked Lists 813
19.4 Stacks 814
19.4.1 Taking Advantage of the Relationship Between Stack and List 815
19.4.2 Implementing a Class Template Stack Class Based By Inheriting
from List 815
19.4.3 Dependent Names in Class Templates 816
19.4.4 Testing the Stack Class Template 817
19.4.5 Implementing a Class Template Stack Class With Composition
of a List Object 818
19.5 Queues 819
19.5.1 Applications of Queues 819
19.5.2 Implementing a Class Template Queue Class Based By
Inheriting from List 820
19.5.3 Testing the Queue Class Template 821
19.6 Trees 823
19.6.1 Basic Terminology 823
19.6.2 Binary Search Trees 824
19.6.3 Testing the Tree Class Template 824
19.6.4 Class Template TreeNode 826
19.6.5 Class Template Tree 827
19.6.6 Tree Member Function insertNodeHelper 829
19.6.7 Tree Traversal Functions 829
19.6.8 Duplicate Elimination 830
19.6.9 Overview of the Binary Tree Exercises 830
19.7 Wrap-Up 831

20 Searching and Sorting 841


20.1 Introduction 842
20.2 Searching Algorithms 843
20.2.1 Linear Search 843
xx Contents

20.2.2 Binary Search 846


20.3 Sorting Algorithms 850
20.3.1 Insertion Sort 851
20.3.2 Selection Sort 853
20.3.3 Merge Sort (A Recursive Implementation) 855
20.4 Wrap-Up 862

21 Class string and String Stream Processing:


A Deeper Look 869
21.1 Introduction 870
21.2 string Assignment and Concatenation 871
21.3 Comparing strings 873
21.4 Substrings 876
21.5 Swapping strings 876
21.6 string Characteristics 877
21.7 Finding Substrings and Characters in a string 880
21.8 Replacing Characters in a string 881
21.9 Inserting Characters into a string 883
21.10 Conversion to Pointer-Based char* Strings 884
21.11 Iterators 886
21.12 String Stream Processing 887
21.13 C++11 Numeric Conversion Functions 890
21.14 Wrap-Up 892

22 Bits, Characters, C Strings and structs 899


22.1 Introduction 900
22.2 Structure Definitions 900
22.3 typedef and using 902
22.4 Example: Card Shuffling and Dealing Simulation 902
22.5 Bitwise Operators 905
22.6 Bit Fields 914
22.7 Character-Handling Library 918
22.8 C String-Manipulation Functions 923
22.9 C String-Conversion Functions 930
22.10 Search Functions of the C String-Handling Library 935
22.11 Memory Functions of the C String-Handling Library 939
22.12 Wrap-Up 943

Chapters on the Web 959


A Operator Precedence and Associativity 961
B ASCII Character Set 963
Contents xxi

C Fundamental Types 965


D Number Systems 967
D.1 Introduction 968
D.2 Abbreviating Binary Numbers as Octal and Hexadecimal Numbers 971
D.3 Converting Octal and Hexadecimal Numbers to Binary Numbers 972
D.4 Converting from Binary, Octal or Hexadecimal to Decimal 972
D.5 Converting from Decimal to Binary, Octal or Hexadecimal 973
D.6 Negative Binary Numbers: Two’s Complement Notation 975

E Preprocessor 981
E.1 Introduction 982
E.2 #include Preprocessing Directive 982
E.3 #define Preprocessing Directive: Symbolic Constants 983
E.4 #define Preprocessing Directive: Macros 983
E.5 Conditional Compilation 985
E.6 #error and #pragma Preprocessing Directives 987
E.7 Operators # and ## 987
E.8 Predefined Symbolic Constants 987
E.9 Assertions 988
E.10 Wrap-Up 988

Appendices on the Web 993


Index 995

Chapters 23–26 and Appendices F–J are PDF documents posted online at the book’s
Companion Website, which is accessible from
http://www.pearsonhighered.com/deitel

See the inside front cover for more information.

23 Other Topics
24 C++11 and C++14: Additional Features
25 ATM Case Study, Part 1: Object-Oriented
Design with the UM
26 ATM Case Study, Part 2: Implementing an
Object-Oriented Design
xxii Contents

F C Legacy Code Topics

G UML: Additional Diagram Types

H Using the Visual Studio Debugger

I Using the GNU C++ Debugger

J Using the Xcode Debugger


Preface
Welcome to the C++ computer programming language and C++ How to Program, Tenth
Edition. We believe that this book and its support materials will give you an informative,
challenging and entertaining introduction to C++. The book presents leading-edge com-
puting technologies in a friendly manner appropriate for introductory college course
sequences, based on the curriculum recommendations of two key professional organiza-
tions—the ACM and the IEEE.1
If you haven’t already done so, please read the back cover and check out the additional
reviewer comments on the inside back cover and the facing page—these capture the
essence of the book concisely. In this Preface we provide more detail for students, instruc-
tors and professionals.
At the heart of the book is the Deitel signature live-code approach—we present most
concepts in the context of complete working programs followed by sample executions,
rather than in code snippets. Read the Before You Begin section to learn how to set up
your Linux-based, Windows-based or Apple OS X-based computer to run the hundreds
of code examples. All the source code is available at
http://www.deitel.com/books/cpphtp10

and
http://www.pearsonhighered.com/deitel

Use the source code we provide to run each program as you study it.

Contacting the Authors


As you read the book, if you have questions, we’re easy to reach at
deitel@deitel.com

We’ll respond promptly. For book updates, visit


http://www.deitel.com/books/cpphtp10

Join the Deitel & Associates, Inc. Social Media Communities


Join the Deitel social media communities on
• Facebook®—http://facebook.com/DeitelFan
• LinkedIn®—http://bit.ly/DeitelLinkedIn

1. Computer Science Curricula 2013 Curriculum Guidelines for Undergraduate Degree Programs in Com-
puter Science, December 20, 2013, The Joint Task Force on Computing Curricula, Association for
Computing Machinery (ACM), IEEE Computer Society.
Another Random Scribd Document
with Unrelated Content
3. Our Heritage.—A. Christianity.

We shall find that the one definite and unswerving tendency of the
traditional thought of Europe has been, first, to establish on earth
that equality between men which from the outset Christianity had
promised them in Heaven; secondly, to assail the prestige of man by
proving that other tenet of the Faith which maintains the general
depravity of human nature; and thirdly, to insist upon truth in the
Christian sense; that is, as an absolute thing which can be, and must
be, made common to all.
At the root of all our science, all our philosophy, and all our
literature, the three fundamental doctrines of Christianity: the
equality of all souls, the insuperable depravity of human nature, and
the insistence upon Truth, are the ruling influences.
By means of the first and third doctrines equality was established in
the spirit, and by means of the second it was established in the
flesh.[13]
By means of the first, each individual, great or small, was granted an
importance[14] undreamt of theretofore,[15] while the lowest were
raised to the highest power; by means of the second, in which the
pride of mankind received a snub at once severe and merciless, the
highest were reduced to the level of the low, while the low were by
implication materially raised; and by means of the third, no truth or
point of view which could not be made general could be considered
as a truth or a point of view at all. Practically it amounted to this,
that in one breath mankind was told, first,
Thy Lord for thee the Cross endured
To save thy soul from Death and Hell;"[16]
secondly, "Thou shalt have no other God before Me;" and thirdly,
"From Greenland's icy mountains
To India's coral strand,
... every prospect pleases,
And only man is vile."[17]
But in each case, as I have pointed out, it was the higher men who
suffered. Because they alone had something to lose. The first notion
—that of equality, threatened at once to make them doubt their own
privileges and powers, to throw suspicion into the hearts of their
followers, and to make all special, exceptional and isolated claims
utterly void. The third—the insistence upon a truth which could be
general and absolute, denied their right to establish their own truths
in the hearts of men, and to rise above the most general truth which
was reality; while in the second—the Semitic doctrine of general sin,
which held that man was not only an imperfect, but also a fallen
being, and that all his kind shared in this shame—there was not
alone the ring of an absence of rank, but also of a universal
depreciation of human nature which was ultimately to lead, by
gradual stages, from a disbelief in man himself to a disbelief in
nobles, in kings and finally in gods.[18]
At one stroke, not one or two human actions, but all human
performances, inspirations and happy thoughts, had been stripped of
their glory and condemned. Man could raise himself only by God's
grace —that is to say, by a miracle, otherwise he was but a fallen
angel, aimlessly beating the air with his broken wings.
These three blows levelled at the head of higher men were fatal to
the artist; for it is precisely in the value of human inspirations, in the
efficiency of human creativeness, and in the irresistible power of
human will, that he, above all, must and does believe. It is his
mission to demand obedience and to procure reverence; for, as we
shall see, every artist worthy the name is at heart a despot.[19]
Fortunately, the Holy Catholic Church intervened, and by its rigorous
discipline and its firm establishment upon a hierarchical principle,
suppressed for a while the overweening temper of the Christian soul,
and all claims of individual thought and judgment, while it also
recognized an order of rank among men; but the three doctrines
above described remained notwithstanding at the core of the
Christian Faith, and awaited only a favourable opportunity to burst
forth and blight all the good that the Church had done.
This favourable opportunity occurred in the person of Martin Luther.
The Reformation, in addition to reinstating, with all their evil
consequences, the three doctrines mentioned above, also produced
a certain contempt for lofty things and an importunate individualism
which has done nought but increase and spread from that day to
this.
Individualism, on a large scale, of course, had been both tolerated
and practised in Gothic architecture, and on this account the
buildings of the Middle Ages might be said to breathe a more truly
Christian spirit[20] than most of the sculpture and the painting of the
same period, which are more hieratic.[21] But it was not until the
Reformation began to spread that the most tiresome form of
individualism, which we shall call Amateurism,[22] received, as it
were, a Divine sanction; and there can be no doubt that it is against
this element in modern life that not only Art, but all forces which aim
at order, law and discipline, will eventually have to wage their most
determined and most implacable warfare.

[13] The Judaic story of the fall of man is at bottom an essentially


democratic one. This absence of rank in sin had no parallel in the
aristocratic Pagan world. Likewise, in the manner of the fall, there
is a total absence of noble qualities. "Curiosity, beguilement,
seductibility and wantonness—in short, a whole series of pre-
eminently feminine passions—were regarded as the origin of evil."
See B. T., pp. 78, 79.
[14] Bury, History of the Later Roman Empire, Vol. I, p. 33.
[15] A., Aph. 43 and 64.
[16] Hymns Ancient and Modern, No. 435.
[17] Ibid., No. 522.
[18] W. P., Vol. II, p. 312: "When it occurs to inferior men to
doubt that higher men exist, then the danger is great," etc. See,
in fact, the whole of Aph. 874.
[19] See A., Aph. 49: "The concept of guilt and punishment,
inclusive of the doctrine of 'grace,' of 'salvation,' and of
'forgiveness'—lies through and through, without a shred of
psychological truth. Sin,... this form of human self-violation par
excellence, was invented solely for the purpose of making all
science, all culture, and every kind of elevation and nobility utterly
impossible."
[20] Ruskin, On the Nature of Gothic Architecture (p. 7),
contrasting the classic and Gothic style, says: "... In the
mediæval, or especially Christian, system of ornament, this
slavery [i.e. the slavery imposed by the classic canon] is done
away with altogether; Christianity having recognized, in small
things as well as great, the individual value of every soul."
[21] In a good deal of the painting and sculpture of the pre-
Renaissance period, too, signs were not lacking which showed
that the Christian ideal of truth was beginning to work its effects
by leading to a realism which I have classified in Lecture II as
Police Art. Of course, a good deal of this realism may also be
accounted for by the reasons which I suggest at the end of Part I
of Lecture III; be this as it may, however, as it is difficult to decide
the actual proportion of either of these influences, the weight of
the Christian doctrine of Truth must not be altogether overlooked
in such productions as Donatello's "Crucifixion" (Capella Bardi, S.
Croce, Florence); Masolino's "Raising of Tabitha" (Carmine,
Florence); Masaccio's Fresco (S. Maria del Carmine, Florence);
Ucello's "Rout of S. Romano" (Uffizi); Andrea del Castagno's
"Crucifixion" (in the Monastery of the Angeli, Florence); and the
really beautiful statues of the Founders in the Cathedral of
Naumburg.
[22] W. P., Vol. II, p. 297: "The terrible consequences of
'freedom'—in the end everybody thinks he has the right to every
problem. All order of rank is banished."

B. Protestantism.
For Protestantism was nothing more nor less than a general rebellion
against authority.[23] By means of it the right of private judgment
was installed once more, and to the individual was restored that
importance which Christianity had acknowledged from the first, and
which only the attitude of the Church had been able to modify. The
layman, with his conscience acknowledged to be the supreme
tribunal, was declared a free man, emancipated even from the law,
[24] or, as Luther said, "free Lord of all, subject to none."[25]

Now, not only the immortal soul of every individual became


important; but also every one of his proclivities, desires and
aspirations. He was told that he could be his own priest if he chose,
[26] and that Christ had obtained this prerogative for him.

Megalomania, in fact, as Nietzsche declares, was made his duty.[27]


"Let men so account of us, as of the ministers of Christ, and
stewards of the mysteries of God."[28]
With these words St. Paul had addressed the Corinthians, and Luther
did not fail to base his strongest arguments upon the text.[29]
"Even the Reformation," says Nietzsche, "was a movement for
individual liberty; 'Every one his own priest' is really no more than a
formula for libertinage.As a matter of fact, the words, 'Evangelical
freedom' would have sufficed—and all instincts which had reasons
for remaining concealed broke out like wild hounds, the most brutal
needs suddenly acquired the courage to show themselves,
everything seemed justified."[30]
Was it at all likely that the formula, "Every one his own priest," was
going to lead to trouble only in ecclesiastical matters? As a matter of
fact we know that Luther himself extended the principle still further
in his own lifetime. By his radical alterations in the church service
Luther gave the laity a much more prominent place in Divine worship
than they had ever had before; for, in addition to the fact that the
liturgy as compiled by him was written almost entirely in the native
tongue, the special attention he gave to the singing of hymns[31]
allowed the people an opportunity of displaying their individual
powers to such an extent that it has even been said that "they sang
themselves into enthusiasm for the new faith."[31]
But these remarkable changes were only symbolic of the changes
that followed elsewhere; for, once this spirit of individual liberty and
judgment had invaded that department of life which theretofore had
been held most sacred, what was there to prevent it from entering
and defiling less sacred sanctuaries?
Bearing in mind the condition of the arts at the present day, and
taking into account a fact which we all very well know; namely, that
thousands upon thousands are now practising these arts who have
absolutely no business to be associated with them in any way, we
are almost inclined to forgive Protestantism and Puritanism their
smashing of our images, and their material iconoclasm; so light does
this damage appear, compared with the other indirect damage they
have done to the spirit of Art, by establishing the fatal precedent of
allowing everybody to touch and speak of everything—however
sacred.
We may argue with Buckle that the English spirit is of a kind which is
essentially Protestant in temper; but this only seems to make the
matter worse.
When Cardinal Newman and Matthew Arnold point, the one to the
evils of Liberalism, and the other to the evils of anarchy, we know to
what they are referring. They are referring to the impossibility,
nowadays, of awakening reverence for anything or for anybody.
"May not every man in England say what he likes?" Matthew Arnold
exclaims. "But," he continues, "the aspirations of culture, which is
the study of perfection, are not satisfied, unless what men say, when
they may say what they like, is worth saying.... Culture indefatigably
tries, not to make what each raw person may like, the rule by which
he fashions himself; but to draw ever nearer to a sense of what is
indeed beautiful, graceful, and becoming, and to get the raw person
to like that."[32]
But what is fatal to culture is no less fatal to art, and thus we find
Nietzsche saying—
"Once spirit was God, then it became man, and now it becometh
mob."[33]
If in the Europe, and especially in the England of to-day, everybody
has a right to every judgment and to every joy; if a certain slavish
truthfulness to nature and reality, rawness and ruggedness, have
well-nigh wrecked higher aspirations, and if everybody can press his
paltry modicum of voice, of thought, of draughtsmanship, of passion
and impudence to the fore, and thus spread his portion of mediocrity
like dodder over the sacred field of Art; it is because the
fundamental principles of the Christian faith are no longer latent or
suppressed in our midst; but active and potent—if not almighty.
It might almost be said that they have reared a special instinct—the
instinct of liberty and of taking liberties, without any particular aim
or purpose; and, by so doing, have thrown all virtue, all merit, all
ambition, not on the side of culture, but on the side of that "free
personality"[34] and rude naturalness, or truth to man's original
savagery, which it seems the triumph of every one, great or small, to
produce.
No one any longer claims the kind of freedom that Pope Paul III
claimed for his protégé Benvenuto Cellini:[35] this would be too
dangerous, because, in a trice, it would be applied to all. Therefore
the insignificant majority get more freedom than is good for them,
and the noble minority are deprived of their birthright.
"Thus do I speak unto you in parable," cries Zarathustra, "ye who
make the soul giddy, ye preachers of equality! Tarantulas are ye unto
me, and secretly revengeful ones!
"But I will soon bring your hiding-places to the light, therefore do I
laugh in your faces my laughter of the height.
"And 'Will to Equality'—that itself shall henceforth be the name of
virtue; and against all that hath power will we raise an outcry!
"Ye preachers of equality, the tyrant frenzy of impotence crieth thus
in you for 'equality': your most secret tyrant longings disguise
themselves in words of virtue!"[36]
And now recapitulating a moment, what have we found our heritage
to consist of, in the realm of the religious spirit?
In the first place: a certain universal acknowledgment and claim of
liberty, which has no special purpose or direction, and which is too
fair to some and unfair to many. Secondly, a devotion to a truth that
could be general, which perforce has reduced us to vulgar reality;
thirdly, a prevailing depression in the value and dignity of man,
resulting from the suspicion that has been cast upon all authority
and all loftiness; and fourthly, a wanton desecrating and befingering
of all sanctuaries by anybody and everybody, which is the inevitable
outcome of that amateur priesthood introduced and sanctified by
Martin Luther.

[23] Buckle, History of Civilization in England, Vol. II, p. 140:


"Whatever the prejudices of some may suggest, it will be
admitted, by all unbiassed judges, that the Protestant
Reformation was neither more nor less than an open rebellion.
Indeed, the mere mention of private judgment, on which it was
avowedly based, is enough to substantiate this fact. To establish
the right of private judgment was to appeal from the Church to
individuals," etc. (See also p. 138 in the same volume.)
Cambridge Modern History, Vol. II, p. 166: "In the Edict of
Worms, Luther had been branded as a revolutionary, then as a
heretic, and the burden of the complaints preferred against him
by the Catholic humanists was, that his methods of seeking a
reformation would be fatal to all order, political or ecclesiastical.
They painted him as the apostle of revolution, a second Catiline."
And p. 174: "The most frequent and damaging charge levelled at
Luther between 1520 and 1525 reproached him with being the
apostle of revolution and anarchy, and predicted that his attacks
on spiritual authority would develop into a campaign against civil
order unless he were promptly suppressed."
[24] A Treatise Touching the Libertie of a Christian, by Martyne
Luther (translated from the Latin by James Bell, 1579. Edited by
W. Bengo' Collyer, 1817), p. 17: "So that it is manifest that to a
Christian man faith sufficeth only for all, and that he needeth no
works to be justified by. Now, if he need no works, then also he
needs not the law: if he have no need of the law, surely he is
then free from the law. So this also is true. The law is not made
for the righteous man, and this is the same Christian libertie."
[25] Ibid., p. 3.
[26] Ibid., p. 31.
[27] W. P., Vol. II, p. 211.
[28] 1 Cor. iv. 1.
[29] Cambridge Modern History, Vol. II, p. 201.
[30] W. P., Vol. I, p. 75.
[31] Emil Naumann, History of Music, Vol. II, p. 429: "With the
Catholics, hymns in the mother tongue were only used at
processions and on high festivals, and were then sung by the
congregation only at Christmas, Easter, and certain other high
feast days. With these exceptions, the Catholic congregational
song consisted of short musical phrases chanted by the priests, to
which the people either responded, or added their voices to the
refrain sung by the choristers from the altar. The part assigned to
the people then was but a very subordinate one." See also the
Introduction to C. von Winterfeld's Sacred Songs of Luther
(Leipzig, 1840).
[32] The Beginnings of Art, by Ernst Grosse, pp. 299, 300; and
Cambridge Modern History, Vol. II, p. 201.
[33] Culture and Anarchy (Smith, Elder, 1909), pp. 11, 12.
[34] Z., I, VII.
[35] E.I., pp. 54, 55.
[36] Sandro Botticelli, by Emile Gebhart (1907), p. 9: "Paul III
âme très haute, répond aux personnes qui lui dénoncent les vices
de son spirituel spadassin: 'Les hommes uniques dans leur art,
comme Cellini, ne doivent pas être soumis aux lois, et lui moins
que tout autre.'"
C. Philosophical Influences.

Now, turning to our heritage in philosophy and science, do we find


that it tends to resist, or to thwart in any way the principles of our
religious heritage? Not in the slightest degree! At every point and at
every stage it has confirmed and restated, with all the pomp of facts
and statistics to support it, what the religious spirit had laid down for
our acceptance. It is superficial and ridiculous to suppose, as Dr.
Draper once supposed, that there has been a conflict between
Religion and Science. I take it that he means the Christian Religion
alone. Such a conflict has never taken place; what has taken place,
however, is a conflict between Science and the Catholic Church. The
Christian Religion and Science together, however, have never had
any such antagonism, and least of all in England, where, from the
time of Roger Bacon,[37] the first English Experimentalist, to the
present day, nothing has been left undone, no stone has been left
unturned, which might establish scientifically that which Christianity,
as we have seen, wished to establish emotionally.
Universal liberty, without a purpose or a direction; the free and
plebeian production of thoughts and theories divorced from all aim
or ideal, after the style in which children are born in the slums;
devotion to a truth that can be common to all; the depression of the
value and dignity of man, and a certain lack of reverence for all
things—these four aspirations of Christianity and Protestantism have
been the aspirations of science, and at the present moment they are
practically attained.
Unfortunately, it is in the nature of human beings to imitate success,
and England's success as a colonizing and constitutional nation has
undoubtedly been a potent force in spreading not only her
commercial, but also her philosophical views among all ambitious
and aspiring Western nations, who guilelessly took the evil with the
good.
The empiricists, Francis Bacon, Hobbes and Locke, were among the
first, by their teaching, to level a decisive blow at genuine thought,
at the man who knows and who is the measure of all things;[38] and
this they did by arriving at a conception of knowledge and thought
that converted the latter into possessions which might be common
to everybody—that is to say, by reducing all knowledge to that which
can be made immediately the experience of all. This was the
greatest blasphemy against the human spirit that has ever been
committed. By means of it, every one, whatever he might be, could
aspire to intellectuality and wisdom; for experience belongs to
everybody, whereas a great spirit is the possession only of the
fewest.
The Frenchmen, Helvetius, Voltaire, Rousseau, Maupertius,
Condillac, Diderot, d'Alembert, La Mettrie and Baron Holbach, were
quick to become infected, and in Germany, despite the essentially
aristocratic influence of Leibnitz,[39] Kant was the first to follow suit.
Begun in this way, English philosophical speculation, as Dr. Max
Schasler says, was forced to grow ever more and more
materialistic[40] in character, and, if "Science has already come very
generally to mean, not that which may be known, but only such
knowledge as every animal with faculties a little above those of an
ant or a beaver can be induced to admit," and if "incommunicable
knowledge, or knowledge which can be communicated at present
only to a portion—perhaps a small portion—of mankind, is already
affirmed to be no knowledge at all,"[41] it is thanks to the efforts of
the fathers of English thought.
Hence Nietzsche's cry, that "European ignobleness, the plebeian ism
of modern ideas—is England's work and invention."[42]
But it is not alone in its vulgarization of the concept of knowledge, or
in its materialistic tendency, that English influence has helped to
reduce the dignity of man and to level his kind; the utilitarians from
Bentham to John Stuart Mill and Sidgwick, by taking the greatest
number as the norm, as the standard and measurement of all
things, ably reflected the Christian principle, of the equality of souls,
in their works, and, incidentally, by so doing, treated the greatest
number exceedingly badly. For what is mediocre can neither be
exalted nor charmed by values drawn from mediocrity, and is
constantly in need of values drawn from super-mediocrity, for its joy,
for its love of life, and for its reconciliation with drabby reality.[43]

[37] It is important here to note, first, that Roger Bacon was an


Aristotelian through his intimate study of the Arabian treatises on
the Greek philosopher, and, secondly, that although Greek
speculation was governed more by insight than experience,
Aristotle forms a striking exception to this rule.
[38] G. E., p. 210: "What is lacking in England, and has always
been lacking, that half-actor and rhetorician knew well enough,
the absurd muddle-head Carlyle, who sought to conceal under
passionate grimaces what he knew about himself: namely, what
was lacking in Carlyle—real power of intellect, real depth of
intellectual perception, in short, philosophy."
[39] In reply to those who said, "Nothing exists in the intellect but
what has before existed in the senses," Leibnitz replied: "Yes,
nothing but the intellect."
[40] Kritische Geschichte der Æsthetik (1872). Speaking of the
English Æstheticians, he says (p. 285), "The fact that there is no
decrease, but rather an increase of Materialism in their thought,
no purification in their meditation from the coarseness of
experience, but rather a gradual immersion in the same, may also
be regarded as characteristic of the development of the English
spirit in general."
[41] Coventry Patmore, Principles in Art, p. 209.
[42] G. E., p. 213.
[43] Even J. S. Mill saw the flaw in his own teaching in this
respect, and acknowledged it openly. See his Liberty, chapter
"The Elements of Well-Being," paragraph 13.

D. The Evolutionary Hypothesis.


Finally, in the latter half of the last century, these two tendencies at
last reached their zenith, and culminated in a discovery which, by
some, is considered as the proudest product of the English mind.
This discovery, which was at once a gospel and a solution of all
world riddles, and which infected the whole atmosphere of Europe
from Edinburgh to Athens, was the Evolutionary Hypothesis as
expounded by Darwin and Spencer.
A more utterly vulgar, mechanistic, and depressing conception of life
and man cannot be conceived than this evolutionary hypothesis as it
was presented to us by its two most famous exponents; and its
immediate popularity and rapid success, alone, should have made it
seem suspicious, even in the eyes of its most ardent adherents.
And yet it was acclaimed and embraced by almost everybody, save
those, only, whose interests it assailed.
How much more noble was the origin of the world as described even
in Genesis, Disraeli was one of the first to see and to declare;[44]
and yet, so strong was the faith in a doctrine which, by means of its
popular proof through so-called facts, could become the common
possession of every tinker, tailor and soldier, that people preferred to
think they had descended from monkeys, rather than doubt such an
overwhelming array of data, and regard themselves still as fallen
angels.
In its description of the prime motor of life as a struggle for
existence; in its insistence upon adaptation to environment and
mechanical adjustment to external influences;[45] in its deification of
a blind and utterly inadequate force which was called Natural
Selection; and above all in its unprincipled optimism, this new
doctrine bore the indelible stamp of shallowness and vulgarity.
According to it, man was not only a superior monkey, but he was
also a creature who sacrificed everything in order to live; he was not
only a slave of habit, but he was a yielding jelly, fashioned by his
surroundings; he was not only a coward, but a cabbage; and, with it
all, he was invoked to do nothing to assist the world process and his
own improvement; for, he was told by his unscrupulous teachers,
that "evil tended perpetually to disappear,"[46] and that "progress
was therefore not an accident, but a necessity."[47]
Thus not only was man debased, but we could now fold our arms
apathetically, and look on while he dashed headlong to his ruin.[48]
"No," said the evolutionists, "we do not believe in a moral order of
things, although our doctrine does indeed seem to be a reflection of
such an order; neither do we believe in God: but we certainly pin our
faith to our little idol Evolution, and feel quite convinced that it is
going to make us muddle through to perfection somehow—look at
our proofs!"
And what are these proofs? On all sides they are falling to bits, and
we are quickly coming to the conclusion that an assembly of facts
can prove nothing—save the inability of a scientist to play the rôle of
a creative poet.
Nietzsche was one of the first to see, that if Becoming were a
reliable hypothesis, it must be supported by different principles from
those of the Darwinian school, and he spared no pains in sketching
out these different principles.[49]
"These English psychologists—what do they really mean?" Nietzsche
demands. "We always find them voluntarily or involuntarily at the
same task of pushing to the front the partie honteuse of our inner
world, and looking for the efficient, governing and decisive principle
in that precise quarter where the intellectual self-respect of the race
would be the most reluctant to find it—that is to say, in slothfulness
of habit, or in forgetfulness, or in blind and fortuitous mechanism
and association of ideas, or in some factor that is purely passive,
reflex, molecular, or fundamentally stupid,—what is the real motive
power which always impels these psychologists in precisely this
direction?"[50]
Not one of these advocates of mechanism, however, realized how
profoundly he was degrading man, and how seriously he had
therefore sullied all human achievement. In their scientific réchauffé
of the Christian concept of man's depravity, they all had the most
hearty faith, and, as there was little in their over-populated and
industrial country to contradict their conclusions, they did not refrain
from passing these conclusions into law.
We can detect nothing in this greatest scientific achievement of the
last century which seriously resists or opposes our heritage in the
realm of the religious spirit. In their fundamentals, the two are one;
And when we take them both to task, and try to discover their
influence upon the world, we wonder not so much why Art is so bad,
but why Art has survived at all.
For, though for the moment we may exclude the influence of earlier
English thought upon general artistic achievement, at least the
degraded condition of Art at the present day cannot be divorced in
this manner from more recent English speculation, for even Mr.
Bosanquet counts Darwin and Lyell among those who have ushered
in the new renaissance of art in England![51]
"At present," says Nietzsche, "nobody has any longer the courage for
separate rights, for rights of domination, for a feeling of reverence
for himself and his equals,—for pathos of distance,... and even our
politics are morbid from this want of courage!"[52]
To-day, when all reverence has vanished, even before kings and
gods, when to respect oneself overmuch is regarded with
undisguised resentment, what can we hope from a quarter in which
self-reverence and reverence in general are the first needs of all?
We can only hope to find what we actually see, and that, as we all
very well know and cannot deny, is a condition of anarchy,
incompetence, purposelessness and chaos.
"Culture ... has a very important function to fulfil for mankind," said
Matthew Arnold. "And this function is particularly important in our
modern world, of which the whole civilization is, to a much greater
degree than the civilization of Greece and Rome, mechanical and
external, and tends constantly to become more so. But, above all, in
our own country has culture a weighty part to perform, because,
here, that mechanical character, which civilization tends to take
everywhere, is shown in the most eminent degree.... The idea of
perfection as an inward condition of the mind and spirit is at
variance with the mechanical and material civilization in esteem with
us, and nowhere, as I have said, so much in esteem as with us."[53]
We may trust that it is not in vain that men like Matthew Arnold and
Nietzsche raised their voices against the spirit of the age. And we
may hope that it is not in vain that lesser men have taken up their
cry.
In any case Nietzsche did not write in utter despair. His words do not
fall like faded autumn leaves announcing the general death that is
imminent. On the contrary, he saw himself approaching a new
century, this century, and he drew more than half his ardour from
the hope that we might now renounce this heritage of the past, the
deleterious effects of which he spent his lifetime in exposing.
"Awake and listen, ye lonely ones!" he says. "From the future winds
are coming with a gentle beating of wings, and there cometh good
tidings for fine ears.
"Ye lonely ones of to-day, ye who stand apart, ye shall one day be a
people, and from you who have chosen yourselves, a chosen people
shall arise.
"Verily a place of healing shall the earth become! And already a new
odour lieth around it, an odour which bringeth salvation—and a new
hope."[54]

[44] See Froude's The Earl of Beaconsfield (9th Edition), pp. 176,
177: "The discoveries of science are not, we are told, consistent
with the teachings of the Church.... It is of great importance
when this tattle about science is mentioned, that we should
attach to the phrase precise ideas. The function of science is the
interpretation of nature, and the interpretation of the highest
nature is the highest science. What is the highest nature? Man is
the highest nature. But I must say that when I compare the
interpretation of the highest nature by the most advanced, the
most fashionable school of modern science with some other
teaching with which we are familiar I am not prepared to admit
that the lecture room is more scientific than the Church. What is
the question now placed before society, with a glib assurance the
most astounding? The question is this: Is man an ape or an
angel? I, my Lord, I am on the side of the angels. I repudiate with
indignation and abhorrence the contrary view, which I believe
foreign to the conscience of humanity."
[45] See p. 37.**
[46] Spencer, Social Statics (Ed. 1892), p. 27.
[47] Ibid., p. 31.
[48] Two Christian principles are concealed here: 1. The depravity
of man. 2. Faith in a moral order of things.
[49] I have discussed this question, with as much detail as the
space would allow, in Nietzsche, his Life and Works, Chap. IV.
(Constable's Philosophies Ancient and Modern). See also my letter,
"Nietzsche and Science," in the Spectator of 8th January, 1910.
[50] G. M., p. 17.
[51] A History of Æsthetic, p. 445.
[52] A., Aph. 43.
[53] Culture and Anarchy (Smith, Elder, 1909), p. 10.
[54] Z., I, XXII.

Lecture II[1]

Government in Art. Nietzsche's Definition of Art

Part I

Divine Art and the Man-God


"And God blessed them, and God said unto them, Be fruitful, and multiply,
and replenish the earth, and subdue it: and have dominion over the fish of
the sea, and over the fowl of the air, and over every living thing that moveth
upon the earth."—Genesis i. 28.

Man has ceased from believing in miracles, because he is convinced


that the divine power of the miracle-worker has departed from him.
At last he has proclaimed the age of wonders to be at an end,
because he no longer knows himself capable of working wonders.
He acknowledges that miracles are still needed. He hears the
distressing cry for the super-natural everywhere. All about him to-
day he feels that wonders will have to be worked if the value of Life,
of his fellows, and of himself is to be raised, by however little; and
yet he halts like one paralyzed before the task he can no longer
accomplish, and finding that his hand has lost its cunning and that
his eye has lost its authority, he stammers helplessly that the age of
miracles has gone by.
Everything convinces him of the fact. Everybody, from his priest to
his porter, from his wife to his astrologer, from his child to his
neighbour, tells him plainly that he is no longer divine, no longer a
god, no longer even a king!
Not only has the age of miracles gone by; but with it, also, has
vanished that age in which man could conceive of god in his own
image. There are no gods now; because man himself has long since
doubted that man is godlike.
Soon there will be no kings,[2] finally there will be no greatness at
all, and this will mean the evanescence of man himself.
To speak of all this as the advance of knowledge, as the march of
progress, as the triumph of science, and as the glories of
enlightenment, is merely to deck a corpse, to grease-paint a sore,
and to pour rose-water over a cesspool.
If the triumph of science mean "The Descent of Man"; if the glories
of enlightenment mean, again, the descent of man; and if progress
imply, once more, the descent of man; then the question to be
asked is: in whose hands have science, enlightenment and the care
of progress fallen?
This world is here for us to make of it what we will. It is a field of
yielding clay, in which, like sandboys, we can build our castles and
revel in our creations.
But what are these people doing? In building their castles they grow
ever more like beavers, and ants, and beetles. In laying out their
gardens they grow ever more like slugs, and worms, and centipedes.
And their joy seems to be to feel themselves small and despised.
Once, for instance, their sky was the mighty god Indra; the clouds
were his flock, and he drove his flock across his vast fields—blue and
fragrant with delicate flowers. Their fruitful rain was the milk which
their god Indra obtained from his herd of cows, and their seasons of
drought were times when the god Indra was robbed by brigands of
his flock.
Now, their sky is infinite space. Their clouds are masses of vapour in
a state of condensation more or less considerable, and their rain is
the outcome of that condensation becoming too considerable.
Not so many years ago their Heaven and their Earth were the father
and mother of all living things, who had become separated in order
that their offspring might have room to live and breathe and move.
And thus their mists were the passionate sighs of the loving wife,
breathing her love heavenwards; and the dew, the tearful response
of her affectionate and sorrowful spouse.
Now, their Heaven is a thing that no one knows anything at all
about. Their Earth is an oblate spheroid revolving aimlessly through
a hypothetical medium called ether; their mists are vaporous
emanations; while their dew is a discharge of moisture from the air
upon substances that have irradiated a sufficient quantity of heat.
Their Sun was once a god with long, shining streams of golden hair,
of which every year their goddess Night would rob him, thus leaving
Winter mistress of the earth.
Now, their sun is the central orb of their Solar system. It consists of
a nucleus, it is surrounded by a photosphere and a chromosphere,
and has a disease of the face called "spots."
The facts remain the same; the mist still rises, the dew still falls, and
the canopy of Heaven still spans the two horizons. Whatever the
interpretation of these phenomena may be, this at least is certain,
that they are still with us. But there is one thing that changes; one
thing that cannot remain indifferent to interpretation—even though
the facts do not alter,—and that is the soul of man.
A million times more sensitive to changes in interpretation than the
column of mercury is to changes in the atmosphere, the soul of man
rises or falls according to the nobility or the baseness of the meaning
which he himself puts into things; and, just as, in this matter, he
may be his own regenerator, so, also, may he be his own assassin.

[1] Delivered at University College on Dec. 8th, 1910.


[2] W. P., Vol. II, p. 187: "The time of kings has gone by, because
people are no longer worthy of them. They do not wish to see the
symbol of their ideal in a king, but only a means to their own
ends." See also Z., III, LVI.

1. The World "without form" and "void."

For, in the beginning, the world was "without form" and "void,"
things surrounded man; but they had no meaning. His senses
received probably the same number of impressions as they do now—
and perhaps more—but these impressions had no co-ordination and
no order. He could neither calculate them, reckon with them, nor
communicate[3] them to his fellows.
Before he could thus calculate, reckon with, and communicate the
things of this world, a vast process of simplification, co-ordination,
organization and ordering had to be undertaken, and this process,
however arbitrarily it may have been begun, was one of the first
needs of thinking man.
Everything had to be given some meaning, some interpretation, and
some place; and in every case, of course, this interpretation was in
the terms of man, this meaning was a human meaning, and this
place was a position relative to humanity.
Perhaps no object is adequately defined until the relation to it of
every creature and thing in the universe has been duly discovered
and recorded.[4] But no such transcendental meaning of a thing
preoccupied primeval man. All he wished was to understand the
world, in order that he might have power over it, reckon with it, and
communicate his impressions concerning it. And, to this end, the
only relation of a thing that he was concerned with was its relation
to himself. It must be given a name, a place, an order, a meaning—
however arbitrary, however fanciful, however euphemistic. Facts
were useless, chaotic, bewildering, meaningless, before they had
been adjusted,[5] organized, classified, and interpreted in
accordance with the desires, hopes, aims and needs of a particular
kind of man.
Thus interpretation was the first activity of all to thinking humanity,
and it was human needs that interpreted the world.[6]
The love of interpreting and of adjusting—this primeval love and
desire, this power of the sandboy over his castles; how much of the
joy in Life, the love of Life, and, at the same time, the sorrow in Life,
does not depend upon it! For we can know only a world which we
ourselves have created.[7]
There was the universe—strange and inscrutable; terrible in its
strangeness, insufferable in its inscrutability, incalculable in its
multifariousness. With his consciousness just awaking, a cloud or a
shower might be anything to man—a godlike friend or a savage foe.
The dome of blue behind was also prodigious in its volume and
depth, and the stars upon it at night horrible in their mystery.
What, too, was this giant's breath that seemed to come from
nowhere, and which, while it cooled his face, also bent the toughest
trees like straws? The sun and moon were amazing—the one
marvellously eloquent, communicative, generous, hot and
passionate: the other silent, reserved, aloof, cold, incomprehensible.
[8]

But there were other things to do, besides interpreting the stars, the
sun, the moon, the sea, and the sky above. There was the
perplexing multiplicity of changes and of tides in Life, to be mastered
and simplified. There was the fateful flow of all things into death and
into second birth, the appalling fact of Becoming and never-resting,
of change and instability, of bloom and of decay, of rise and of
decline. What was to be done?
It was impossible to live in chaos. And yet, in its relation to man
Nature was chaotic. There was no order anywhere. And, where there
is no order, there are surprises,[9] ambushes, lurking indignities. The
unexpected could jump out at any minute. And a masterful mind
abhors surprises and loathes disorder. His Will to Power is humiliated
by them. To man,—whether he be of yesterday, of to-day or of to-
morrow— unfamiliarity, constant change, and uncertainty, are
sources of great anxiety, great sorrow, great humiliation and
sometimes great danger. Hence everything must be familiarized,
named and fixed. Values must be definitely ascertained and
determined. And thus valuing becomes a biological need. Nietzsche
even goes so far as to ascribe the doctrine of causality to the
inherent desire in man to trace the unfamiliar to the familiar. "The
so-called instinct of causality," he says, "is nothing more than the
fear of the unfamiliar, and the attempt at finding something in it
which is already known."[10]
In the torrent and pell-mell of Becoming, some milestones must be
fixed for the purpose of human orientation. In the avalanche of
evolutionary changes, pillars must be made to stand, to which man
can hold tight for a space and collect his senses. The slippery soil of
a world that is for ever in flux, must be transformed into a soil on
which man can gain some foothold.[11]
Primeval man stood baffled and oppressed by the complexity of his
task. Facts were insuperable as facts; they could, however, be
overcome spiritually—that is to say, by concepts. And that they must
be overcome, man never doubted for an instant—he was too proud
for that. For his aim was not existence, but a certain kind of
existence—an existence in which he could hold his head up, look
down upon the world, and stare defiance even at the firmament.
And thus all humanity began to cry out for a meaning, for an
interpretation, for a scheme, which would make all these distant and
uncontrollable facts their property, their spiritual possessions. This
was not a cry for science, or for a scientific explanation, as we
understand it; nor was it a cry for truth in the Christian sense.[12]
For the bare truth, the bare fact, the bald reality of the thing was
obvious to everybody. All who had eyes to see could see it. All who
had ears to hear could hear it. And all who had nerves to feel could
feel it. If ever there was a time when there was a truth for all, this
was the time; and it was ugly, bare and unsatisfying. What was
wanted was a scheme of life, a picture of life, in which all these
naked facts and truths could be given some place and some human
significance—in fact, some order and arrangement, whereby they
would become the chattels of the human spirit, and no longer
subjects of independent existence and awful strangeness.[13] Only
thus could the dignity and pride of humanity begin to breathe with
freedom. Only thus could life be made possible, where existence
alone was not the single aim and desire.
"The purpose of 'knowledge,' "says Nietzsche, "in this case, as in the
case of 'good,' or 'beautiful,' must be regarded strictly and narrowly
from an anthropocentric and biological standpoint. In order that a
particular species may maintain and increase its power, its
conception of reality must contain enough which is calculable and
constant to allow of its formulating a scheme of conduct. The utility
of preservation—and not some abstract or theoretical need to
eschew deception—stands as the motive force behind the
development of the organs of knowledge.... In other words, the
measure of the desire for knowledge depends upon the extent to
which the Will to Power grows in a certain species: a species gets a
grasp of a given amount of reality in order to master it, in order to
enlist that amount into its service."[14]
And thus "the object was, not to know, but to schematize, to impose
as much regularity and form upon chaos as our practical needs
required."[15]
"The whole apparatus of knowledge," says Nietzsche, "is an
abstracting and simplifying apparatus—not directed at knowledge,
but at the appropriation of things."[16]
No physical thirst, no physical hunger, has ever been stronger than
this thirst and hunger, which yearned to make all that is unfamiliar,
familiar; or in other words, all that is outside the spirit, inside the
spirit.[17]
Life without food and drink was bad enough; but Life without
nourishment for this spiritual appetite, this famished wonder,[18] this
starving amazement, was utterly intolerable!
The human system could appropriate, and could transform into man,
in bone and flesh, the vegetation and the animals of the earth; but
what was required was a process, a Weltanschauung, a general
concept of the earth which would enable man to appropriate also
Life's other facts, and transform them into man the spirit. Hence the
so-called thirst for knowledge may be traced to the lust of
appropriation and conquest,[19] and the "will to truth" to a process
of establishing things, to a process of making things true and
lasting.... Thus truth is not something which is present and which
has to be found and discovered; it is something which has to be
created and which gives its name to a process, or better still, to the
"will to overpower."[20]
For what is truth? It is any interpretation of the world which has
succeeded in becoming the belief of a particular type of man.[21]
Therefore there can be many truths; therefore there must be an
order of rank among truths.
"Let this mean Will to Truth unto you," says Zarathustra, "that
everything be made thinkable, visible, tangible unto man!
"And what ye have called the world, shall have first to be created by
you:[22] your reason, your image, your will, your love shall the world
be! And, verily, for your own bliss, ye knights of Knowledge!"[23]
"The purpose was to deceive oneself in a useful way; the means
thereto was the invention of forms and signs, with the help of which,
the confusing multifariousness of Life could be reduced to a useful
and wieldly scheme."[24]
This was the craving. Not only must a meaning, a human meaning,
be given to all things, in order to subordinate them to man's power;
but Life itself must also be schematized and arranged. And, while all
humanity cried aloud for this to be done, it was humanity's artists
and higher men who set to and did it.[25]

[3] W. P., Vol. II, p. 72: "... Communication is necessary, and for it
to be possible, something must be stable, simple and capable of
being stated precisely."
[4] W. P., Vol. II, p. 65.
[5] Okakura-Kakuzo, The Book of Tea, p. 58: "Adjustment is Art."
[6] W. P., Vol. II, p. 13. See also Th. Gomperz, Greek Thinkers,
Vol. I, p. 25. Speaking of interpretation, he says: "And this
tendency was notably strengthened by the suspicious
circumstances of external life, which awoke the desire for
clearness, distinctness and a logical sequence of ideas."
[7] W. P., Vol. II, p. 21. See also Max Müller, Introduction to the
Science of Religion, pp. 198-207, T. I., Part 10, Aph. 19.
[8] Hegel, in his Vorlesungen über Æsthetik (Vol. I, p. 406), says:
"If we should wish to speak of the first appearance of symbolic
Art as a subjective state, we should remember that artistic
meditation in general, like religious meditation—or rather the two
in one—and even scientific research, took their origin in
wonderment."
[9] Hegel makes some interesting remarks on this point. See his
Vorlesungen über Æsthetik, Vol. I, p. 319. He shows that the
extreme regularity of gardens of the seventeenth century was
indicative of their owners' masterful natures.
[10] W. P., Vol. II, p. 58. See also p. 11: "to 'understand' means
simply this: to be able to express something new in the terms of
something old or familiar."
[11] W. P., Vol. II, p. 88.
[12] W. P., Vol. II, p. 26: "The prerequisite of all living things and
of their lives is: that there should be a large amount of faith, that
it should be possible to pass definite judgments on things, and
that there should be no doubt at all concerning values. Thus it is
necessary that something should be assumed to be true, not that
it is true."
[13] Felix Clay, The Origin of the Sense of Beauty, p. 95: "The
mind or the eye, brought face to face with a number of
disconnected and apparently different facts, ideas, shapes,
sounds or objects, is bothered and uneasy; the moment that
some central conception is offered or discovered by which they all
fall into order, so that their due relation to one another can be
perceived and the whole grasped, there is a sense of relief and
pleasure which is very intense."
[14] W. P., Vol. II, p. 12.
[15] W. P., Vol. II, p. 29.
[16] W. P., Vol. II, p. 24.
[17] W. P., Vol. II, p. 76. Hegel was also approaching this truth
when he said, in his introduction to the Vorlesungen über
Æsthetik (pp. 58, 59 of the translation of that Introduction by B.
Bosanquet): "Man is realized for himself by poetical activity,
inasmuch as he has the impulse, in the medium which is directly
given to him, and externally presented before him, to produce
himself. This purpose he achieves by the modification of external
things upon which he impresses the seal of his inner being. Man
does this in order, as a free subject, to strip the outer world of its

You might also like