October 1999
Beginner
304 pages
7h 11m
English
Each of our numeric sequences is a good candidate for a class. A numeric sequence class object represents a range of elements within its associated sequence. By default, the beginning position is 1. For example,
Fibonacci fib1( 7, 3 );
defines a Fibonacci class object of 7 elements beginning at position 3, and
Pell pel( 10 );
defines a Pell class object of 10 elements beginning at the default position of 1. Finally,
Fibonacci fib2( fib1 );
initializes fib2 to a copy of fib1.
Each class must keep track both of its length — how many elements of the series are represented — and of a beginning position. A 0 or negative beginning position or length is not permitted. We store both the ...
Read now
Unlock full access