Homework #3


Design
1) Define common field types to be used by our MSCUFlatFile class. Try to have the field type reflect real-world work experience (for example, how are date fields really stored, in your experience?).

2) The MSCUFlatFile will need a collection of MSCUObject pointers, and a collection of string objects. These collection classes will be to maintain fields in a record. Design how these items should be implemented. Use any means at your disposal.

The MSFlatFile class will need functions to manipulate fields. Think about, and document, how they should work:


3) Think of how you want the MSCUFlatFile to work. Determine what it's purpose is. Decide what functions will be needed in the class. Try to model these functions after databases you have used. Just design the basic operations, and keep in mind that we want a record-number based access method.


Changes to the MSCU classes
Change the following in MSCUObject:
virtual const string GetAsString() const { throw "Unimplemented feature"; return(0);}

Add the following function to the MSCUObject class:
virtual MSCUObject* Clone() const { throw "Unimplemented feature"; return(0);} // To support dynamic creation
virtual int Compare( const MSCUObject& Src) const // Provides a built-in basic comparison method
{
return( GetAsString().compare(Src.GetAsString() );
}
virtual int operator==( const MSCUObject& Src ) const // Use comparison method for common operators
{
return( Compare( Src )==0 );
}
virtual MSCUObject& operator=( const MSCUObject& Src ) // Basic data transfer support
{
SetFromString(Src.GetAsString() ); return(*this);
}


Add the following to MSCUDate:
virtual MSCUObject* Clone() const { return( new MSCUDate(this) ); }

Add a Clone method to your MSCUSSN class, and any other MSCUObject-derived classes you expect to use as a field in a MSCUFlatFile.