programming-examples/c++/Others/IntCell.cpp - IntCell class implementation (Fig 1.8).cpp
2019-11-15 12:59:38 +01:00

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;
}