MathStudent::MathStudent(const MathStudent& otherStudent)
{

	address = new char[strlen(otherStudent.GetAddress())+1];
	strcpy(address, otherStudent.GetAddress());

	city    = new char[strlen(otherStudent.GetCity())+1];
	strcpy(city, otherStudent.GetCity());

	state   = new char[strlen(otherStudent.GetState())+1];
	strcpy(state, otherStudent.GetState());

	zipCode = otherStudent.GetZipCode();

	SetName(otherStudent.GetName());
	SetStanding(otherStudent.GetStanding());
	SetNumber(otherStudent.GetNumber());
	SetId(otherStudent.GetId());
	SetAge(otherStudent.GetAge());
	SetGpa(otherStudent.GetGpa());
	SetGender(otherStudent.GetGender());
	SetAllDate(otherStudent.GetMonth(), otherStudent.GetDay(),otherStudent.GetYear());
	SetObjectCount(otherStudent.GetObjectCount());


	cout << "\nCopy constructor has been called.";
}
MathStudent::MathStudent()
{
	SetObjectCount(count);

	address    = new char[5];
	strcpy(address, "add");

	city       = new char[5];
	strcpy(city, "cit");

	state      = new char[5];
	strcpy(state, "sta");

	zipCode    = 0;

	SetName(" ");
	SetStanding(" ");
	SetNumber(" ");
	SetId(0);
	SetAge(0);
	SetGpa(0.0);
	SetGender('X');
	SetAllDate(0,0,0);

}
void PdfVecObjects::insert_sorted( PdfObject* pObj )
{
    SetObjectCount( pObj->Reference() );
    pObj->SetOwner( this );

    if ( m_bSorted ) {
      TVecObjects::iterator i_pos = std::lower_bound(m_vector.begin(),m_vector.end(),pObj,ObjectLittle);
      m_vector.insert(i_pos, pObj );
    } else m_vector.push_back( pObj );
 
}
void PdfVecObjects::push_back( PdfObject* pObj )
{
    SetObjectCount( pObj->Reference() );

//  Ulrich Arnold 30.7.2009 must sort if INSIDE range
//	if( !m_vector.empty() && m_vector.back()->Reference() < pObj->Reference() )
    if( !m_vector.empty() && pObj->Reference() < m_vector.back()->Reference() )
        m_bSorted = false;

    pObj->SetOwner( this );
    m_vector.push_back( pObj );
}
void PdfVecObjects::AddFreeObject( const PdfReference & rReference )
{
    std::pair<TIPdfReferenceList,TIPdfReferenceList> it = 
        std::equal_range( m_lstFreeObjects.begin(), m_lstFreeObjects.end(), rReference, ReferenceComparatorPredicate() );

    if( it.first != it.second && !m_lstFreeObjects.empty() ) 
    {
        // Be sure that no reference is added twice to free list
        PdfError::DebugMessage( "Adding %d to free list, is already contained in it!", rReference.ObjectNumber() );
        return;
    }
    else
    {
        // When append free objects from external doc we need plus one number objects
        SetObjectCount( rReference );

        // Insert so that list stays sorted
        m_lstFreeObjects.insert( it.first, rReference );
    }
}
MathStudent::MathStudent(const char *   newAddress,
						 const char *   newCity,
						 const char *   newState,
						 long           newZipCode,
						 string         newName,
						 string         newStanding,
						 string         newNumber,
						 long           newId,
						 unsigned short newAge,
						 double         newGpa,
						 char           newGender,
						 int            newMonth,
						 int            newDay,
						 int            newYear
						  ):

						Student( newName,
						    	 newStanding,
								 newNumber,
								 newId,
								 newAge,
								 newGpa,
								 newGender)

{
	address = new char[strlen(newAddress)+1];
	strcpy(address, newAddress);

	city    = new char[strlen(newCity)+1];
	strcpy(city, newCity);

	state   = new char[strlen(newState)+1];
	strcpy(state, newState);

	zipCode = newZipCode;

	count++;
	SetObjectCount(count);

}