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
Changing Field width The printf() and scanf() functions from the standard library, use width specifier for controlling the width of its output . Similarly, the ostream class al


Problem: (a) Show the Java approach to event processing by explaining how event handling works in Java. Make use of a suitable example to support your answer. (b) Describe

What is the purpose of return values? Can you not return any values from a function? If you could what would he function look like?

We need an E Commerce site likefifacointrader. you must have experience with that kind of work You have to show a sample of work like that site. Skills required are C Prog

The program sorting.cpp contains a main function for testing the operation of several sort algorithms over various data sizes and data set organisations. The program understands

In this lab, please complete a given program to perform the following tasks: 1. Allocate a 10 by 5 2D byte array dynamically. The way of allocation must be consistent with page

Algorithm for railway ticket booking process

flowchart of c programing to check the given number is prime or not