StrBuf::operator =( const StrPtr & )
Assign a StrBuf from a StrPtr.
|
Virtual? |
No |
|
|
Class |
||
|
Arguments |
|
(implied) reference of the |
|
Returns |
|
Notes
Initialize the StrBuf and the StrPtr before
assignment.
Any memory allocated for the StrBuf's buffer
is separate from the memory for the StrPtr's
buffer.
Example
#include <iostream>
#include <stdhdrs.h>
#include <strbuf.h>
int main( int argc, char **argv )
{
StrRef sr( "xyz" );
StrPtr *sp = &sr;
StrBuf sb;
sb = *sp; // assign StrBuf from StrPtr
cout << sp- → Text() returns \" << sp->Text() << "\"\n";
cout << "sb.Text() returns \"" << sb.Text() << "\"\n";
}
Executing the preceding code produces the following output:
sp->Text() returns "xyz" sb.Text() returns "xyz"