Tracing of abstract array - c++ program, C/C++ Programming

Tracing of Abstract array:

inline int isZero( const Object& o )

{

    return o == NOOBJECT;

}

 

int AbstractArray::isEqual( const Object& obj ) const

{

    PRECONDITION( isA() == obj.isA() );

    AbstractArray& test = (AbstractArray&)obj;

    if( lowerBound() != test.lowerBound() ||

        upperBound() != test.upperBound()

      )

        return 0;

 

    ContainerIterator& iter1 = initIterator();

    ContainerIterator& iter2 = test.initIterator();

    while( iter1 && iter2 )

        if( iter1.current() != iter2.current() )

            {

            delete &iter1;

            delete &iter2;

            return 0;

            }

        else

            {

            iter1++;

            iter2++;

            }

 

    delete &iter1;

    delete &iter2;

    return 1;

}

 

void AbstractArray::printContentsOn( ostream& outputStream ) const

{

    ContainerIterator& printIterator = initIterator();

    printHeader( outputStream );

    while( printIterator != 0 )

        {

        Object& arrayObject = printIterator++;

        if( arrayObject != NOOBJECT )

            {

            arrayObject.printOn( outputStream );

            if( printIterator != 0 )

                printSeparator( outputStream );

            else

                break;

            }

        }

    printTrailer( outputStream );

    delete &printIterator;

}

 

 

 

Posted Date: 10/18/2012 6:18:55 AM | Location : United States







Related Discussions:- Tracing of abstract array - c++ program, Assignment Help, Ask Question on Tracing of abstract array - c++ program, Get Answer, Expert's Help, Tracing of abstract array - c++ program Discussions

Write discussion on Tracing of abstract array - c++ program
Your posts are moderated
Related Questions
The project will include Arena models (only .doe files) and MSWord document for the report. Thereport must contain the following sections: 1. Introduction: (a)    Statemen

wap to print padovan string in c

how do I randomised numbers in an array?

The game of hangman may have originated in the Victorian era, and involves trying to guess a word by suggesting letters. The game is played as follows: A word is chosen and the pl

assume that the first integer read with cin specifies the number of values remaining to be entered. that program should read only one value each time cin is executed .a typical inp

Q. Explain that how do we implement two stacks in one array A[1..n] in such a way that neither the stack overflows unless the total number of elements in both stacks together is n.

Define Array of Structures? An Array of Structures is an assortment of the same data types which are declared as structures. It is useful to store large and different number of

C Program to copy the contents of a file: void main()    {   ifstream fin("input.txt");   ofstream fout("output.txt");   char ch;   while (fin)       {

I need to implement a mini version of linux''s ''tar'' function in C.

Project Description: I want an experienced programmer to program an RFID tag that will be read (maybe also written), and perform a call to a Filmmaker Pro 13 database. Skills