StrBuf::operator =( const StrBuf & )

Assign a StrBuf from another StrBuf.

Virtual?

No

 

Class

StrBuf

 

Arguments

const StrBuf &buf

(implied) reference of the StrBuf from which assignment occurs

Returns

void

 

Notes

Initialize both StrBufs before the assignment.

Any memory allocated for the assigned StrBuf's buffer is separate from the memory for the StrBuf's buffer from which assignment occurs.

Do not assign a StrBuf to itself.

Example

#include <iostream>

#include <stdhdrs.h>
#include <strbuf.h>

int main( int argc, char **argv )
{
    StrBuf sba;
    StrBuf sbb;

    sba.Set( "xyz" );

    sbb = sba;   // assign StrBuf to StrBuf

    cout << "sba.Text() returns \"" << sba.Text() << "\"\n";
    cout << "sbb.Text() returns \"" << sbb.Text() << "\"\n";
}

Executing the preceding code produces the following output:

sba.Text() returns "xyz"
sbb.Text() returns "xyz"