28 lines
555 B
C++
28 lines
555 B
C++
|
IntCell.cpp - IntCell class implementation (Fig 1.8)
|
||
|
|
||
|
#include "IntCell.h"
|
||
|
|
||
|
/**
|
||
|
* Construct the IntCell with initialValue
|
||
|
*/
|
||
|
|
||
|
IntCell::IntCell( int initialValue ) : storedValue( initialValue )
|
||
|
{
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Return the stored value.
|
||
|
*/
|
||
|
int IntCell::read( ) const
|
||
|
{
|
||
|
return storedValue;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Store x.
|
||
|
*/
|
||
|
void IntCell::write( int x )
|
||
|
{
|
||
|
storedValue = x;
|
||
|
}
|