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
Looping Statements The statements usually used for looping are for, do-while, while. The goto statement can be used for looping, but its use is generally avoided as it leads to

Using a Friend Using a friend function is quite easy. The following example explains a friend function to access members of two classes. class Bclass;

F r i e n dly Function: A class can have public members and private members.   The public member can be used through the class using dot operator.   Where as private me

Talking to IO boards inside a computer or microcontroller depends upon the principles used by the microprocessor to address physical devices. On Motorola systems all devices connec


Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Aim: To implement program to calculate area of cube using inline function. Code: inline void area_cube(float side) {             float area;             are

how to create a shopping cart and sibmit the code segment on screan

how to pass array

d) a "static destructor" is a static member function of the class which accepts one argument - a pointer to the object of that class to be cracked. It is probably utilized along wi