On Wed, May 6, 2009 at 12:07 PM, mark <[email protected]> wrote:
> Mark.h
>
> #pragma once    //i am using visual c++ 2008 compiler/ide, this is equvilaent 
> to #ifndef mark_h... etc...
> #include <string>       //is this part needed here?
> class MyClass
> {
> public:
>        int id;
>        MyClass(int);
>
>        ~MyClass(){}
>
>        string func()  // i want this function to return the string below, but 
> it doesnt
>        {
>                return "6767";
>        }


string func()
{
    string newString = "6767";
    return newString;
}

Be careful, of course, returning references to local variables (in
this case, we are returning a copy of the local variable).

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to