On Wed, May 6, 2009 at 5:16 PM, Brett McCoy <[email protected]> wrote:
> 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
I'm quite surprised the compiler isn't barfing on a missing std:: there.
>> {
>> return "6767";
Addressed below.
>> }
>
>
> 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).
--
PJH
http://shabbleland.myminicity.com/com
http://www.chavgangs.com/register.php?referer=9375