It is obvious from Ada’s letters that her “notes” were entirely her own and that Babbage was
acting as a sometimes unappreciated editor. At one point, Ada wrote to him,
I am much annoyed at your having altered my Note. You know I am always willing
to make any required alterations myself, but that I cannot endure another person
to meddle with my sentences.
Ada gained the title Countess of Lovelace when she married Lord William Lovelace. The cou-
ple had three children, whose upbringing was left to Ada’s mother while Ada pursued her work
in mathematics. Her husband was supportive of her work, but for a woman of that day, such
behavior was considered almost as scandalous as some of her father’s exploits.
Ada died in 1852, just one year before a working Difference Engine was built in Sweden from
one of Babbage’s designs. Like her father, Ada lived only to age 36. Even though they led very
different lives, she undoubtedly had admired him and took inspiration from his
unconventional and rebellious nature. In the end, Ada asked to be buried beside him at the
family’s estate.
Java lets us group related classes in a package so that encapsulation protects the whole col-
lection. Within the package, it allows the related classes to communicate directly. Direct ac-
cess is more efficient than converting back and forth between external and internal
representations when classes share a common internal representation.
Also, when a derived class overrides or hides members of its superclass, it can no longer
refer to them directly. Java provides additional syntax and semantics that enable a subclass
to access such superclass members when the need arises.
In the next section, we examine the Java semantics for accessing members from dif-
ferent places. Then we can return to the specifics of implementing a hierarchy of de-
rived classes.
7.5 Scope of Access
In writing a Java class, we declare variables, constants, and methods that are given
identifiers. Java defines a set of rules that specify where those identifiers can then
be used, both inside and outside of the class. We say that the rules determine the
scope of accessof an identifier.The term is usually shortened toscope, and the rules
are thus called thescope rulesof the language.
The scope rules for access within a class (internal access scope rules) are
straightforward and do not depend on the access modifiers attached to an iden-
tifier. External access scope rules determine where an identifier can be used out-
side of a class and depend on both the access modifiers and the location where
the access takes place. We look first at internal scope and then at external scope.
Scope of access (scope) The
region of program code where it
is legal to reference (use) an
identifier
Scope rules The rules that de-
termine where in a program an
identifier may be referenced,
given the point where the iden-
tifier is declared and its specific
access modifiers
7.5 Scope of Access | 339