You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
747 B
C++

MemoryCell.cpp - MemoryCell class implementation (Fig 1.21)
#include "MemoryCell.h"
/**
* Construct the MemoryCell with initialValue
*/
template <class Object>
MemoryCell<Object>::MemoryCell( const Object & initialValue )
: storedValue( initialValue )
{
}
/**
* Return the stored value.
*/
template <class Object>
const Object & MemoryCell<Object>::read( ) const
{
return storedValue;
}
/**
* Store x.
*/
template <class Object>
void MemoryCell<Object>::write( const Object & x )
{
storedValue = x;
}