J5121982 wrote:
CString myclass::getStr() { CString strarr[]={"JAYARAJ","bala"} return strarr; } i get error .. how to do it...?
Of course u have type conflict. It look like you wrote int myclass::getInt() { int arr[]={1,1} return arr; } May be this helps:
CString[] myclass::getStr()
{
CString strarr[]={"JAYARAJ","bala"}
return strarr;
}
It should work, if no then try this
CString *myclass::getStr()
{
CString strarr[]={"JAYARAJ","bala"}
return (CString *)strarr;
}
BTW strarr seems to have local scope. So what you want to return is unclear. If I understand what you try to do, it better to declare it in class itself:
class myclass{
...
public: /*private if you want*/
CString strarr[]={"JAYARAJ","bala"}
....
}
or specify static class storage
CString[] myclass::getStr()
{
static CString strarr[]={"JAYARAJ","bala"}
return strarr;
}
-- modified at 2:42 Friday 31st March, 2006 -- modified at 2:48 Friday 31st March, 2006