J
Justin Naidl
class Foo
{
protected:
char foo_stuff[16];
public:
char* get_foo_stuff();
}
Given the above example. What I want to know is the "proper/standard" way
of returning foo_stuff in an accessor function without giving the user
access to the data directly. The way I currently have it set up is to creat
an entirely new char array and strcpy foo_stuff into it and return the
address of the new array. I don't particularly like that method as it
requires that the caller manually delete the data that is returned. So, I
guess at this point I will leave it to the experts.
Thanks,
~Justin
{
protected:
char foo_stuff[16];
public:
char* get_foo_stuff();
}
Given the above example. What I want to know is the "proper/standard" way
of returning foo_stuff in an accessor function without giving the user
access to the data directly. The way I currently have it set up is to creat
an entirely new char array and strcpy foo_stuff into it and return the
address of the new array. I don't particularly like that method as it
requires that the caller manually delete the data that is returned. So, I
guess at this point I will leave it to the experts.
Thanks,
~Justin