LuckyStarr
Programmer
Hi All,
I'm a C++ newbie. I'm having a problem compiling the following code:
<code>
typedef char Message[20];
class StaticHelloWorld{
public:
static Message hello;
static void setMessage(Message message){
strcpy(hello,message);
return;
}
static Message getMessage(){
return hello;
}
};
// Definition of the static variable hello
Message StaticHelloWorld::hello = "Ueba";
</code>
The compiler says that functions cannot return arrays or functions at line "return hello;". But it seems for me that it's returning the pointer to the hello array.
So what's the problem? I can't figure it out.
Thanks in advance,
Ricardo.
---
There is no Knowledge that is not power
---
I'm a C++ newbie. I'm having a problem compiling the following code:
<code>
typedef char Message[20];
class StaticHelloWorld{
public:
static Message hello;
static void setMessage(Message message){
strcpy(hello,message);
return;
}
static Message getMessage(){
return hello;
}
};
// Definition of the static variable hello
Message StaticHelloWorld::hello = "Ueba";
</code>
The compiler says that functions cannot return arrays or functions at line "return hello;". But it seems for me that it's returning the pointer to the hello array.
So what's the problem? I can't figure it out.
Thanks in advance,
Ricardo.
---
There is no Knowledge that is not power
---