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
How do you access the values within an array? - Arrays comprise a number of elements, which depends on the size you assigned it during variable declaration. - Every element

Define  T y pe c o m p a t i b i li t y? T o a s s i g n i n t t o s m a l l i n t t h e v a r i a b l e should b e

Q: Can I overload operator == so it allow me compare two char[] by a string comparison? A: No: at least one operand of particular overloaded operator should be of some user-defi

Define Some Features of Automatic Variables in C program? The features of automatic variables are like as Storage - memory Default initial value - an unpredictable value,

Aim: To implement a program to allocate memory dynamically for 2 dimensional array (accept and print matrix) using pointers. Code:                       #include #inc

write a c program that multiplies 3 martices

find the greater of the two variables, without using conditional loops or ternary operators?

Question : (a) Define a Pointer. Provide an example of an integer pointer variable. (b) Give advantages of using pointers over arrays. (c) Declare an integer pointer

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

To develop a web crawler such that when given a base URL, it will traverse the entire web tree and then build an index of keywords and what URL link they appear on.   The web crawl