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

#include <counter.h>

Collaboration diagram for dsac::design::Counter:
Collaboration graph

Public Member Functions

 Counter ()
 Constructs a new Counter with value zero.
 
 Counter (int initial)
 
int get_value () const
 
void increment ()
 Increments the counter value by one.
 
void increment (int delta)
 
void reset ()
 Resets the counter value to zero.
 

Constructor & Destructor Documentation

◆ Counter() [1/2]

dsac::design::Counter::Counter ( )

Constructs a new Counter with value zero.

◆ Counter() [2/2]

dsac::design::Counter::Counter ( int  initial)

Constructs a new Counter with given initial value.

Parameters
initialthe initial value

Member Function Documentation

◆ get_value()

int dsac::design::Counter::get_value ( ) const

Returns the current counter value.

Returns
the current counter value

◆ increment() [1/2]

void dsac::design::Counter::increment ( )

Increments the counter value by one.

◆ increment() [2/2]

void dsac::design::Counter::increment ( int  delta)

Increments the counter value by the specified delta.

Parameters
deltathe amount of the increment

◆ reset()

void dsac::design::Counter::reset ( )

Resets the counter value to zero.


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