StrRef::StrRef( const StrPtr & ) (constructor)

Construct a StrRef, referencing an existing string.

Virtual?

No

 

Class

StrRef

 

Arguments

const StrPtr &

a StrPtr to reference

Returns

StrRef

 

Notes

If arguments are provided, the constructor calls Set() with them.

Example

#include <iostream>

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

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

    str1.Set( "abc" );
    StrRef sr = StrRef( str1 );

    cout << "str1 = \"" << str1.Text() << "\"\n";
    cout << "sr.Text() returns \"" << sr.Text() << "\"\n";
}

Executing the preceding code produces the following output:

str1 = "abc"
sr.Text() returns "abc"