Hi,
I wanted to to do the following and was wondering if that is the correct way-
// I need to create an instance of another class XYZClass using the member variable m_xyz. The instance ob would be used and modified by the member functions func1, func2, func3 etc of MyClass, but I need the value of ob to persist between function calls. Could you please tell me the correct way to go about this?
[code=cpp]
static XYZClass ob(m_abc);
Class MyClass
{
private:
const char* m_abc;
public:
MyClass(const char * abc)
{
m_abc = abc;
}
int init();
int func1();
int func2();
int func3();
int exit();
}
}[/code]
I wanted to to do the following and was wondering if that is the correct way-
// I need to create an instance of another class XYZClass using the member variable m_xyz. The instance ob would be used and modified by the member functions func1, func2, func3 etc of MyClass, but I need the value of ob to persist between function calls. Could you please tell me the correct way to go about this?
[code=cpp]
static XYZClass ob(m_abc);
Class MyClass
{
private:
const char* m_abc;
public:
MyClass(const char * abc)
{
m_abc = abc;
}
int init();
int func1();
int func2();
int func3();
int exit();
}
}[/code]
Comment