C++ Programming: An Object-Oriented Approach, 1e ISE 1st Edition Behrouz A. Forouzan - eBook PDF pdf download
C++ Programming: An Object-Oriented Approach, 1e ISE 1st Edition Behrouz A. Forouzan - eBook PDF pdf download
https://ebooksecure.com/download/c-programming-an-object-
oriented-approach-1e-ise-ebook-pdf/
http://ebooksecure.com/product/ebook-pdf-microsoft-visual-c-an-
introduction-to-object-oriented-programming-7th-edition/
https://ebooksecure.com/download/foundations-of-computer-science-
ebook-pdf/
https://ebooksecure.com/download/design-patterns-elements-of-
reusable-object-oriented-software-ebook-pdf/
https://ebooksecure.com/download/data-communications-and-
networking-with-tcp-ip-protocol-suite-ebook-pdf/
Programming in C 1st Edition - eBook PDF
https://ebooksecure.com/download/programming-in-c-ebook-pdf/
https://ebooksecure.com/download/readings-from-programming-with-
c-ebook-pdf-2/
https://ebooksecure.com/download/readings-from-programming-with-
c-ebook-pdf/
http://ebooksecure.com/product/object-relations-theory-and-
practice-an-introduction-ebook-pdf/
https://ebooksecure.com/download/principles-of-microeconomics-a-
streamlined-approach-4e-ise-ebook-pdf/
C++ Programming:
An Object-Oriented Approach
Behrouz A. Forouzan
Richard F. Gilberg
C++ PROGRAMMING: AN OBJECT-ORIENTED APPROACH
Published by McGraw-Hill Education, 2 Penn Plaza, New York, NY 10121. Copyright © 2020 by McGraw-Hill Education. All rights
reserved. Printed in the United States of America. No part of this publication may be reproduced or distributed in any form or by any
means, or stored in a database or retrieval system, without the prior written consent of McGraw-Hill Education, including, but not
limited to, in any network or other electronic storage or transmission, or broadcast for distance learning.
Some ancillaries, including electronic and print components, may not be available to customers outside the United States.
1 2 3 4 5 6 7 8 9 LWI 21 20 19
All credits appearing on page or at the end of the book are considered to be an extension of the copyright page.
The Internet addresses listed in the text were accurate at the time of publication. The inclusion of a website does not indicate an endorse-
ment by the authors or McGraw-Hill Education, and McGraw-Hill Education does not guarantee the accuracy of the information presented
at these sites.
mheducation.com/highered
To my wife, Faezeh
Behrouz A. Forouzan
To my wife, Evelyn
Richard F. Gilberg
This page intentionally left blank
Brief Table of Contents
Preface xv
Chapter 1 Introduction to Computers and Programming Languages 1
Chapter 2 Basics of C++ Programming 19
Chapter 3 Expressions and Statements 59
Chapter 4 Selection112
Chapter 5 Repetition158
Chapter 6 Functions208
Chapter 7 User-Defined Types: Classes 273
Chapter 8 Arrays338
Chapter 9 References, Pointers, and Memory Management 380
Chapter 10 Strings443
Chapter 11 Relationships among Classes 496
Chapter 12 Polymorphism and Other Issues 553
Chapter 13 Operator Overloading 597
Chapter 14 Exception Handling 657
Chapter 15 Generic Programming: Templates 693
Chapter 16 Input/Output Streams 716
Chapter 17 Recursion776
Chapter 18 Introduction to Data Structures 813
Chapter 19 Standard Template Library (STL) 852
Chapter 20 Design Patterns Available online
v
Appendixes A-R Available online
Appendix A Unicode
Appendix B Positional Numbering System
Appendix C C++ Expressions and Operators
Appendix D Bitwise Operations
Appendix E Bit Fields
Appendix F Preprocessing
Appendix G Namespaces
Appendix H Ratios
Appendix I Time
Appendix J Lambda Expressions
Appendix K Regular Expressions
Appendix L Smart Pointers
Appendix M Random Number Generation
Appendix N References
Appendix O Move versus Copy
Appendix P A Brief Review of C++ 11
Appendix Q Unified Modeling Language (UML)
Appendix R Bitset
Index 915
Contents
Preface xv
What Is the C++ Language? xv
Why This Book? xv
Appendicesxvi
Instructor Resources xvii
Acknowledgmentsxvii
1
Introduction to Computers and Programming Languages 1
2
Basics of C++ Programming 19
vii
viii Contents
3
Expressions and Statements 59
3.1 Expressions59
3.2 Type Conversion 71
3.3 Order of Evaluation 76
3.4 Overflow and Underflow 81
3.5 Formatting Data 85
3.6 Statements93
3.7 Program Design 98
Key Terms 105
Summary105
Problems106
Programs110
4
Selection 112
5
Repetition 158
5.1 Introduction158
5.2 The while Statement 161
5.3 The for Statement 175
5.4 The do-while Statement 180
5.5 More About Loops 184
5.6 Other Related Statements 188
5.7 Program Design 191
Key Terms 203
Summary203
Problems204
Programs206
Contents ix
6
Functions 208
6.1 Introduction208
6.2 Library Functions 213
6.3 User-Defined Functions 224
6.4 Data Exchange 233
6.5 More About Parameters 244
6.6 Scope and Lifetime 248
6.7 Program Design 256
Key Terms 265
Summary265
Problems266
Programs269
7
User-Defined Types: Classes 273
7.1 Introduction273
7.2 Classes275
7.3 Constructors and Destructors 283
7.4 Instance Members 294
7.5 Static Members 302
7.6 Object-Oriented Programming 311
7.7 Designing Classes 320
Key Terms 332
Summary332
Problems333
Programs335
8
Arrays 338
9
References, Pointers, and Memory Management 380
9.1 References380
9.2 Pointers391
9.3 Arrays and Pointers 405
9.4 Memory Management 414
9.5 Program Design 425
Key Terms 437
Summary437
Problems437
Programs442
10
Strings 443
11
Relationships among Classes 496
11.1 Inheritance496
11.2 Association519
11.3 Dependency528
11.4 Program Design 532
Key Terms 546
Summary546
Problems547
Programs550
12
Polymorphism and Other Issues 553
12.1 Polymorphism553
12.2 Other Issues 567
Contents xi
13
Operator Overloading 597
14
Exception Handling 657
14.1 Introduction657
14.2 Exceptions in Classes 675
14.3 Standard Exception Classes 682
Key Terms 688
Summary688
Problems689
Programs692
15
Generic Programming: Templates 693
16
Input/Output Streams 716
16.1 Introduction716
16.2 Console Streams 720
16.3 File Streams 729
16.4 String Streams 751
16.5 Formatting Data 755
16.6 Program Design 766
Key Terms 773
Summary773
Problems774
Programs774
17
Recursion 776
17.1 Introduction776
17.2 Recursive Sort and Search 792
17.3 Program Design 803
Key Terms 808
Summary808
Problems809
Programs811
18
Introduction to Data Structures 813
18.1 Introduction813
18.2 Singly Linked List 815
18.3 Stacks and Queues 825
18.4 Binary Search Trees 841
Key Terms 849
Summary850
Problems850
Programs851
Contents xiii
19
Standard Template Library (STL) 852
20
Design Patterns Online
20.1 Introduction
20.2 Creational Patterns
20.3 Structural Patterns
20.4 Behavioral Patterns
Key Terms
Summary
Problems
Programs
Online Appendices
Appendix A Unicode
Appendix B Positional Numbering System
Appendix C C++ Expressions and Operators
Appendix D Bitwise Operations
Appendix E Bit Fields
Appendix F Preprocessing
xiv Contents
Appendix G Namespaces
Appendix H Ratios
Appendix I Time
Appendix J Lambda Expressions
Appendix K Regular Expressions
Appendix L Smart Pointers
Appendix M Random Number Generation
Appendix N References
Appendix O Move versus Copy
Appendix P A Brief Review of C++ 11
Appendix Q Unified Modeling Language (UML)
Appendix R Bitset
Index 915
Preface
This book complements a course designed to teach object-oriented programming using the syntax
of the C++ language. It will also prepare students for advanced concepts such as data structure
and design patterns. Students who have completed this course will be ready to take on any other
object-oriented language course, a data-structure course, or a course about design patterns.
Course Outline
The twenty chapters of the book are outlined in the following figure.
Chapter 1
Chapter 6
Chapter 7 Chapter 8
Chapter 10 Chapter 9
Chapter 11
Chapter 12
Chapter 13
Legend:
Chapter 17 Basic C++ language
Object-oriented concepts
Chapter 18 Can be taught in anywhere after chapter 7
Chapter 19 Can be taught if time allows (second course)
Data structures (optional)
Chapter 20 Design patterns (optional)
Appendices
Appendices can be found online and are divided into six categories.
References
Appendices A to E are designed to be used as references for students. Students may need to
consult these appendices when studying chapters in the book.
Language Knowledge
Appendices F and G give students information about how C++ prepares a source code for
compilation and how it handles names in different sections.
Preface xvii
Advanced Topics
Appendixes H to O discuss some advanced topics that were added to C++. They can be
taught in the class, or students can use them as a source of additional information.
Bitset
The concept of bitset becomes more popular when C++ is used in network programming.
We have included this topic in Appendix R.
Instructor Resources
Accompanying this text are several additional resources which can be found online at www
.mhhe.com/forouzan1e. These include CheckPoint questions that help instructors gauge stu-
dent understanding after reading each section of a chapter. True/false and review questions
are also available to further test student’s knowledge. Complete solutions to the CheckPoint
features, true/false questions, review questions, and problems are provided as well. Lastly,
Lecture PPTs, text image files, and sample programs are provided as well.
Acknowledgments
We would like to express our gratitude to the reviewers of this text. Their insight and sug-
gestions over the last few years greatly influenced this first edition. In alphabetical order, the
reviewers are as follows:
At McGraw-Hill, we would like to thank the following editorial and production staff:
Thomas Scaife, Senior Portfolio Manager; Suzy Bainbridge, Executive Portfolio Manager;
Heather Ervolino, Product Developer; Shannon O’Donnell, Marketing Manager; Patrick
Diller, Business Project Manager; and Jane Mohr, Content Project Manager.
This page intentionally left blank
1 Introduction to Computers
and Programming Languages
In this chapter, we describe the components of a computer system and discuss the general
ideas behind computer languages. The overview provided in this chapter will help prepare
you for future chapters. You can skip the chapter in the first reading and return to it when
you have a better understanding of programming.
Objectives
After you have read and studied this chapter, you should be able to:
1
2 Chapter 1 Introduction to Computers and Programming Languages
CPU
Bus
ALU Registers
Control unit
executes instructions such as arithmetic calculations and comparisons among data. Figure 1.2
shows the general idea behind a central processing unit.
Primary Memory
Primary memory is where programs and data are stored temporarily during processing.
The contents of primary memory are lost when we turn off the computer. Figure 1.3 shows
primary memory in more detail. Each storage location in memory has an address, much like
a street address, that is used to reference the memory’s contents. The addresses in Figure
1.3(a) are shown on the left as numbers ranging from zero to (n – 1), where n is the size of
memory. In Figure 1.3(b) the address is shown symbolically as x.
0
1 Address Contents
Operating
system
x 256
256
15.34
Hello Data
n−1
(a) General layout
Figure 1.3 Primary memory
(photo) ©Simon Belcher/Alamy
1.1 Computer System 3
Secondary Storage
Programs and data are stored permanently in secondary storage. When we turn off the
computer, our programs and data remain in the secondary storage ready for the next time
we need them. Examples of secondary storage include hard disks, CDs and DVDs, and flash
drives (Figure 1.4).
Input System
The input system is usually a keyboard where programs and data are entered into the com-
puter. Examples of other input devices include a mouse, a pen or stylus, a touch screen, or
an audio input unit (Figure 1.5).
Output System
The output system is usually a monitor or a printer where the output is displayed or printed.
If the output is displayed on the monitor, we say we have a soft copy. If it is printed on the
printer, we say we have a hard copy (Figure 1.6).
Communication System
We can create a network of computers by connecting several computers. Communication
devices are installed on a computer system for this purpose. Figure 1.7 shows some of these
devices.
4 Chapter 1 Introduction to Computers and Programming Languages
System Software
System software consists of programs that manage the hardware resources of a computer
and perform required information processing. These programs are divided into three groups:
the operating system, system support, and system development.
Operating System The operating system provides services such as a user interface, file and
database access, and interfaces to communication systems. The primary purpose of this soft-
ware is to operate the system in an efficient manner while allowing users access to the
system.
System Support System support provides system utilities and other operating services. Ex-
amples of system utilities are sort programs and disk format programs. Operating services
consist of programs that provide performance statistics for the operational staff and security
monitors to protect the system and data.
System Development System development software includes the language translators that
convert programs into machine language for execution, debugging tools to assure that the
programs are error-free, and computer-assisted software engineering (CASE) systems that
are beyond the scope of this book.
1.2 Computer Languages 5
Application Software
Application software is broken into two categories: general-purpose software and
application-specific software.
General-Purpose Software General-purpose software is purchased from a software devel-
oper and can be used for more than one application. Examples of general-purpose software
include word processors, database management systems, and computer-aided design sys-
tems. These programs are called general purpose because they can solve a variety of user
computing problems.
Application-Specific Software Application-specific software can be used only for its in-
tended purpose. A general ledger system used by accountants and a material requirements
planning system used by engineers are examples of application-specific software. They can
be used only for the task they were designed for; they cannot be used for other generalized
tasks.
High-level languages
Symbolic languages
Machine languages
Time
1940 1950 1960 1970 1980 1990 2000 2010
Over the years, several other languages—most notably BASIC, Pascal, Ada, C, C++,
and Java—were developed. Today, one of the popular high-level languages for system soft-
ware and new application code is C++, which we discuss in this book.
Computer language
paradigms
Object-
Procedural Functional Logic
oriented
a
b
sum
a 6 6
input a b
sum
input b
a 6
sum = a + b 8
b 8
output sum sum
a 6
Program b 8
sum 14
a 6
b 8 14
14
sum 14
States
a. If we are writing code for different programs, we can package the code and create
what is called a procedure (or function). A procedure can be written once and then
copied in different programs. The standard procedures can be stored in the language
library and be used instead of rewritten.
b. If we are handling a large set of data items (for example, hundred or thousands of
numbers), we need to store them in a package (called different names such as array
or record) and input them all together, process them all together, and output them
all at the same time. The operation at the background is still done one data item at a
time, but the program can see the data items as packages.
The following shows how a procedural paradigm uses three lines of code to sort a list of
numbers of any size. Of course, we must have already written the procedures and already
packaged data items into a list.
input (list);
sort (list);
output (list);
Objects
13 17 8 10 list1
sort ( )
reverse ( )
11 17 38 14 list2
search (...)
print (...)
Shared 12 10 91 20 listn
Procedures
in any typical dish-washing machine. However, each time we load the machine with a dif-
ferent set of dishes (same as a different set of data). We need to be careful, however, not to
load the machine with a load it is not designed for (not to wash clothes, for example, in the
dish-washing machine).
In the real world, all the hardware necessary for an operation is included in an object;
in the object-oriented programming world, each object holds only data, but the code that
defines the procedures is shared. Figure 1.12 shows the relationship between the procedures
and data in the object-oriented paradigm.
list (6, 8)
first () rest ()
Visualization
element is (8). The function first gets a number, but the function rest gets a list. To get
the second number in the list, we first use the function rest to get the list (8) and then use
the function first to get 8.
What type of numbers are we dealing with (with fractions or without fractions)?
Are the numbers arranged in any special sequence, such as lowest to highest?
How many numbers can we expect?
If we don’t clarify the problem—that is, if we make assumptions about the input or
the output—we may supply the wrong answer. To answer our questions, we need to process
integers arranged in any sequence. There is no limit as to the number of integers.
As this example shows, even the simplest problem statements may require clarifica-
tion. Imagine how many questions must be asked for a program that contains hundreds or
thousands of detailed statements.
13 7 19 29 23
We begin with a simple assumption: The algorithm processes the numbers one at a
time. We name the algorithm FindLargest. Every algorithm has a name to identify it.
FindLargest looks at each number in turn without knowing the values of the others. As it
processes each number, it compares it to the largest number known to that point and deter-
mines if the new number is larger. It then looks at the next number to see if it is larger, and
then the next number and the next number until all of the numbers have been processed.
Figure 1.15 shows the steps in determining the largest among five integers.
The algorithm requires that we keep track of two values, the current number and the
largest number found. We determine the largest number using the following steps.
∙∙ Step 1: We input the first number, 13. Since largest has no value, we set it to the
value of the first number.
∙∙ Step 2: We input the second number, 7. Since 7 is less than 13, the value of largest
does not need to be changed.
∙∙ Step 3: We input the third number 19. When we compare 19 to the value of largest, 13,
we see that 19 is larger. We therefore set largest to 19.
∙∙ Step 4: We input the fourth number, 29. When we compare 29 to the value of largest,
19, we see that 29 is larger. We set largest to 29.
∙∙ Step 5: We input the fifth number, 23. Because it is smaller than 29, largest does not
need to be changed. Because there is no more input, we are done and we have deter-
mined that the largest value is 29.
∙∙ Step 6: We output the value of largest, which is 29.
Discovering Diverse Content Through
Random Scribd Documents
Sinun altis Einar Henning."
Mikä tietää, ehkä Einar vain oli ovela. Ehkäpä hän kirjoitti tämän
ankaran kirjeen vain tyydyttääkseen isäänsä ja äitiään. Mutta oli
kuitenkin heitä taivutellut…
Vouti Henning oli koko ajan katsellut häntä ankarasti. Nyt hän
sanoi verkkaan ja painolla:
Gunvor taisi hieman kalveta. Hänestä oli hyvin ilkeätä istua tässä
huoneessa. Mitä noilla oli hänelle asiaa? Olivatko ne hänen
vihamiehiään? Miksi ne puhuivat sellaista?
Gunvor vastasi:
"Hyvänen aika, mitä arvella siitä, mitä puhut, Einar. Mitä minun on
sinun isäsi mielestä tehtävä? Sinä aikana, kun kävin viimeksi täällä,
ei yhtään lämmintä sanaa minulle. Minä en siedä sitä tapaa. Sinä
tarkoitat, että pitäisi noin vain olla nöyrä ja rakastettava. Minä en ole
muokattu siten kunnioittamaan."
"Minusta sinä olet liian hätäinen, Gunvor. Jos sen tahdot tietää,
minä olen tässä asiassa samaa mieltä kuin isäni. Minäkään en pidä
noista vapaista ajattelemisista!"
Gunvor katsoi Einariin. Oliko Einar ihan tosissaan? Gunvorhan oli
kertonut hänelle kaikki isästään… siitä lähtien… Ah, Einar oli vain
muka tarkoittavinaan.
"Toinen asia on", jatkoi Einar, "se että sinä pidät isästäsi ja muistat
häntä isänäsi. Sehän on kylläkin kaunista… Mutta hänen
ajatuksensa, mitä? niitä ei sinun sovi niin kiivaasti puolustaa."
"Hst, elä nyt huuda! Ihmiset kaikki kuulevat!" lausui Einar aivan
kiihkeästi ja tuijotti levottomana pariin kulkijaan, jotka olivat
pysähtyneet kadun toiselle puolelle.
"En, en, elä vain koske minuun!" vastasi Gunvor hiljaa ja poistui…
Hän kulki kauan hiljaa. Sitten hän alkoi vaikerrella, kuiskaten kuin
hirveässä tuskassa.
"Sellainen siis Einar oli. Siitä nyt näin hänet kokonaan. Sellainen
mies. Sellainen siis oli mies."
KOLMAS KIRJA
I.
Mutta kun Gunvor kertoi hänelle, mihin se asia päättyi; kun hän
kuuli, miten yksimielisesti nuo kaksi miestä olivat syyttäneet Kjeldiä,
ja kun hän näki Gunvorin syvän surun, silloin hän näytti ikäänkuin
heräävän. Hellät silmät tulivat luja-ilmeisiksi, silmäterät laajenivat,
pää kohosi. Hän tuli aivan toisellaiseksi kuin oli yksin istuessaan ja
levätessään. Ikäänkuin taistelu kutsui häntä jälleen. Hän hytkähti
tuolissaan, mutta vavahti kuten ihminen, jonka elinkohtaan isketään,
vaan jolla kuitenkin on voimaa kostaa.
"Miten heikko minä olen ollut viime aikoina. Niin taipuisa ja untelo.
Nyt minä palaan jälleen Kjeldin luo. Gunvor… Minä palaan Kjeldin
luo."
Tahi kaupunki. Siellä oli ihmisiä, joiden elämä oli vaikeaa. Heidän
ilonsa olivat olleet suurin osin huokausta. Ehkä he tiesivät suuret
syntinsä. He eivät halunneet pappeja. Pappi olisi vaatinut heiltä
ainoastaan katumusta ja uskoa seikkoihin, joita juuri pappi itse
uskoi. Ja lisäksi hän olisi puhunut helvetistä.
Kaikki se tuli nyt. Gunvor, joka suoriaisi elosta ilolla ja leikillä, jos
hän vain myöntyisi ja tinkisi siinä ja siinä kohden… hänen täytyi kuin
täytyikin käydä rintamaan. Hän oli Johannes Kjeldin tytär. Hän näki
sen selvästi. Hänen kirkkaimmassakin ilossaan olivat kaukaiset äänet
häntä usein kutsuneet ja hän oli kuunnellut. Nyt ne kutsuivat häntä
kovemmin, ja hän kuunteli jälleen niiden sanoja. Hän ei itkenyt ilon
kaipuusta… Tora… Tora, jota hän oli rakastanut, oli taipunut itkun ja
surun kuorman alla. Mutta hän oli ollut alusta alkaen päivänpaisteen
lapsi. Mutta Gunvor oli jo pienenä rakastanut isäänsä, tuota suurta,
yksinäistä, ja monta kertaa olivat jo pahuus ja halveksinta
itkettäneet häntä.
Kannettu kaipuu oli tosin ollut monta kertaa kovaa. Mutta kukaan
ei saanut sitä hänessä huomata. Siksi eli hän pitkät ajat yksin.
Leikatkoon veitsi, tippukoon veri, ja menkööt haavat umpeen. Hän
jutteli ainoastaan äitinsä kanssa. Hän käveli joka päivä, mutta ei
kaupunkiin päin. Hän kulki toisella taholla kuin muut. Kaupungista
ojentausi yksinäinen katu kauas, kuin metsään ja erämaahan
osoittaen. Se päättyi jyrkkään polkuun, joka nousi vuorelle. Sitä
polkua hän käveli. Siellä ei kulkenut ketään tuttuja. Hän kiersi siellä
joka päivä. Sohjussa, sateessa, pyryssä. Jotain vanhaa murtui, ja
uutta rakennettiin. Hän aivan laihtui noina aikoina, hänen silmänsä
tulivat tarkkaaviksi, hänestä hälveni pehmeys. Hänen kasvonsa
muuttuivat puhdaspiirteisiksi ja kylmiksi…
Kevät tuli. Uusi kesä pilkistihe. Miten outoa ajatella: vain vuosi
sitten oli se suuri kesä, jolloin Tora ja hän olivat olleet yksissä,
saman tunteen täyttäminä. Jolloin aurinko kultasi pitkät tiet, jolloin
kukat aukoivat umpujaan joka tarhassa, jolloin he kumpikin
rakastivat löytämäänsä… Oi, mitenkä he molemmat olivat olleet
älyttömiä ja iloisia, valmiita tuhlaamaan kaiken, mitä he olivat
koonneet. Niinkuin naiset voivat tuhlata. Kaiken elämän, mitä heillä
oli ja minkä he tahtoivat antaa hänelle.
Tämä talvi, joka nyt oli vierinyt: usvaa, joka olisi tukehuttanut
hänet, jos se olisi palannut! Kaksi kirjettä Toralta, joka kertoi
elämästänsä siellä etelässä, työstään ja edistymisestään, — ja vain
yksi kirje Gunvorilta Toralle. Torallekaan hän ei voinut uskoa täysin…
niin, kyllä kaiken muun, mutta ei tätä… vaikka Tora silloin oli
kertonut hänelle… oh, he olivat niin erilaisia, ehkäpä hän juuri
sentähden rakasti Toraa…
Ja Janna, joka oli ensin käynyt hänen luonaan. Silloin oli se paha
hyvin vaikeaa. Kun hän ei vielä voinut sietää ketään.
Ja nekin hän muisti: nuo Einar Henningin kirjeet! Nyt tahtoi Einar
selittää koko asian! Hänellä oli ensin ollut pahin puuha
käännyttääkseen rakasta isäänsä. Ja hän oli samalla aikaa tahtonut
säästää Gunvoria, siksi ei hän koskaan maininnut sanaakaan hänelle.
Jos Gunvor siis olisi ollut hieman viisas ja ovela, jos hän olisi antanut
rakkaan isän huomata, että hän oli hiljainen, kiltti nainen, niin olisi
kaikki käynyt hyvin… Einarilla oli kai oikeus pyytää selitystä, miksi
hän oli niin käyttäytynyt…
"No kyllä sinä olet jaksanut sitä surua surra. Herra Jumala, sinä ja
Tora! niinpä tuottaa kauneus melkein pahempaa surua… — Niin, ole
varma siitä, kyllä minä järjestän asiasi… Ala vain heti kohta. Lue
kesällä jo. Niin että ehkä voit syksyllä suorittaa tutkinnon. Niin, ensi
syksynä, ymmärrätkös."
Hän luki koko pitkän kesän. Aamusta iltaan. Joskus hän kohotti
päätänsä ja katsoi yli matalan katon, joka oli vastapäätä. Hän näki
sen takana vielä toisenkin katon, ja lepuutti sitten silmiään pienessä
metsikössä, joka oli täydessä lehdessä, tuuheaa kesän mehuista.
Hän oli sitkeä ja voitti nuo vastahakoiset sivut, jotka olivat sullotut
täyteen tietoja, joita hän ei juuri kaivannut, mutta jotka hän tahtoi
saada.
Jos joku niistä olisi paha… tosiaan paha… Niin, silloin sitä
koetettaisiin! Jos hän kuuntelisi tarkkaan, jos hän seuraisi kahta
hartaammin, — eiköhän hän pääsisi hänestä selville? Juuri siinä oli
kuunneltavaa. Juuri siinä voi lasku tulla pulmalliseksi, ja vaikeaksi
ratkaista. Juuri nuo köyhäin kotien kalpeat pienokaiset kaipasivat
vapaata, armeliasta ihmistä…
Mutta kohta kun Janna oli puhunut, nousi Jan Grögaard, ja kaikki
huomasivat, että nyt hänellä oli jotakin sanottavaa.
Hän valvoi sinä yönä ja ajatteli uutta työtä, joka hänellä nyt oli
edessä. Hän ryhtyi siihen niin rohkein mielin. Ja mikään ei kytkenyt
häntä, mikään vanha petos ei pidättänyt häntä. Hän tarkasteli
itseänsä hartaasti, ja kaikki viime vuosien tunteet olivat kuolleet ja
haipuneet! Hän ei niitä kaivannut, ei toivonut mitään takaisin!
IV.
Ainoa, jota hän ehkä kaipasi siltä ajalta, oli se pehmoinen, kalpea,
joka ilmestyi hänen sielunsa silmäin eteen, kun hän lausui Tora
Pharon nimen: tuo iloinen, aistillinen Tora, joka uhkui musiikkia ja
rakkautta… ja vielä se heikko ja surullinen Tora, hän, joka ikäänkuin
soljui hänen huoneestansa pois sinä viimeisenä iltana: "Hyvästi,
Gunvor!"
Einar alkoi jutella: hän oli varma siitä, että Gunvor muisti hänet!
Niin, Gunvor ei unhoittaisi häntä. Hän näki Gunvorin silmistä, että
hän yhä muisteli häntä.
Jan Grögaardia hän tapasi nyt hyvinkin usein. He olivat aina olleet
hyvässä sovussa. Mutta siitä illasta alkaen, jolloin Grögaard piti
puheen hänelle, oli Gunvor saanut häneltä jotakin, jota ei voinut
unhoittaa… Niin, nuo hänen sanansa, jotka hän lausui kuin näyn
nähden, ne olivat ikäänkuin vihkineet hänet uuteen elämään
ihmisenä ja naisena.