O
Ook
I have a function getStuff, and two choices of implementation:
const string *getStuff()
{
return &_stuff;
}
or
const string getStuff()
{
return _stuff;
}
where _stuffis just a string: string _stuff;
I can call the second one like this:
string zoot;
zoot = getStuff;
Why would I want to use the first one in the above examples, and how
would I call it? I can't just use zoot = getStuff because I get a
compiler error.
const string *getStuff()
{
return &_stuff;
}
or
const string getStuff()
{
return _stuff;
}
where _stuffis just a string: string _stuff;
I can call the second one like this:
string zoot;
zoot = getStuff;
Why would I want to use the first one in the above examples, and how
would I call it? I can't just use zoot = getStuff because I get a
compiler error.