@@ -46,7 +46,7 @@ As an example, you can imagine an object that provides an interface to
4646an area on your screen. It provides a way to draw shapes or text onto
4747this area but hides all the details of how these shapes are converted
4848to the actual pixels that make up the screen. You'd have a set of
49- methods, for example `drawCircle`, and those are the only things you
49+ methods— for example, ++drawCircle++— and those are the only things you
5050need to know in order to use such an object.
5151
5252(((object-oriented programming)))These ideas were initially worked out
@@ -113,13 +113,11 @@ fatRabbit.speak("I could sure use a carrot right now.");
113113// right now.'
114114----
115115
116- (((rabbit example)))The code uses the `this` keyword to output the
117- type of rabbit that is speaking.
118-
119- (((apply method)))(((bind method)))(((this)))Recall that the `apply`
120- and `bind` methods both take a first argument that can be used to
121- simulate method calls. This first argument is in fact used to give a
122- value to `this`.
116+ (((apply method)))(((bind method)))(((this)))(((rabbit example)))The
117+ code uses the `this` keyword to output the type of rabbit that is
118+ speaking. Recall that the `apply` and `bind` methods both take a first
119+ argument that can be used to simulate method calls. This first
120+ argument is in fact used to give a value to `this`.
123121
124122[[call_method]]
125123(((call method)))There is a method similar to `apply`, called `call`.
@@ -506,8 +504,8 @@ function)))(((polymorphism)))(((overriding)))When you call the
506504`String` function, which converts a value to a string, on an object,
507505it will call the `toString` method on that object to try to create a
508506meaningful string to return. I mentioned that some of the standard
509- prototypes define their own version of `toString` in order to be able
510- to create a string that contains more useful information than
507+ prototypes define their own version of `toString` so they can
508+ create a string that contains more useful information than
511509`"[object Object]"`.
512510
513511(((object-oriented programming)))This is a simple instance of a
@@ -902,8 +900,8 @@ setter is defined, writing to the property is simply ignored.
902900(((inheritance)))(((table example)))(((alignment)))(((TextCell
903901type)))We are not quite done yet with our table layout exercise. It
904902helps readability to right-align columns of numbers. We should create
905- another cell type that is like `TextCell` but rather than padding the
906- lines on the right side it pads them on the left side so that they
903+ another cell type that is like `TextCell`, but rather than padding the
904+ lines on the right side, it pads them on the left side so that they
907905align to the right.
908906
909907(((RTextCell type)))We could simply write a whole new ((constructor))
@@ -946,7 +944,7 @@ instances of this type will also have access to the properties in that
946944prototype. Finally, we can override some of these properties by adding
947945them to our new prototype.
948946
949- (((dataTable function)))Now if we slightly adjust the `dataTable`
947+ (((dataTable function)))Now, if we slightly adjust the `dataTable`
950948function to use ++RTextCell++s for cells whose value is a number, we
951949get the table we were aiming for.
952950
@@ -1071,10 +1069,10 @@ to properties of the same name.
10711069(((addition)))(((subtraction)))Give the `Vector` prototype two
10721070methods, `plus` and `minus`, that take another vector as a parameter
10731071and return a new vector that has the sum or difference of the two
1074- vectors’ (the one in `this` and the parameter) x and y values.
1072+ vectors’ (the one in `this` and the parameter) _x_ and _y_ values.
10751073
10761074Add a ((getter)) property `length` to the prototype that computes the
1077- length of the vector—that is, the distance of the point (x, y ) from
1075+ length of the vector—that is, the distance of the point (_x_, _y_ ) from
10781076the origin (0, 0).
10791077
10801078ifdef::interactive_target[]
0 commit comments