Data Structures & Algorithms in C++
Goodrich, Tamassia, Mount and Goldwasser
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes
dsac::design::FibonacciProgression Class Reference

#include <fibonacci_progression.h>

Inheritance diagram for dsac::design::FibonacciProgression:
Inheritance graph
Collaboration diagram for dsac::design::FibonacciProgression:
Collaboration graph

Public Member Functions

 FibonacciProgression (long first=0, long second=1)
 
- Public Member Functions inherited from dsac::design::Progression
 Progression (long start=0)
 
virtual ~Progression ()
 Destructs the progression.
 
long next_value ()
 
void print_progression (int n)
 

Protected Member Functions

virtual void advance ()
 Replaces (prev,current) with (current,current+prev)
 
virtual void advance ()
 Advances the current value to the next value of the progression.
 

Protected Attributes

long prev
 
- Protected Attributes inherited from dsac::design::Progression
long current
 

Constructor & Destructor Documentation

◆ FibonacciProgression()

dsac::design::FibonacciProgression::FibonacciProgression ( long  first = 0,
long  second = 1 
)
inline

Constructs a Fibonacci sequence using the given first and second values

Parameters
firstthe first value of the sequence (default: 0)
startthe second value of the sequence (default: 1)

Member Function Documentation

◆ advance()

virtual void dsac::design::FibonacciProgression::advance ( )
inlineprotectedvirtual

Replaces (prev,current) with (current,current+prev)

Reimplemented from dsac::design::Progression.

Field Documentation

◆ prev

long dsac::design::FibonacciProgression::prev
protected

The documentation for this class was generated from the following file: