I have a class who do some things.
class ClassA
{
public:
ClassA()
{
for (unsigned i = 0; i < MAX_PROCESS_ID; ++i)
processDB[i] = 0;
};
virtual ~ClassA(){ };
int create(int pID);
bool check(int pID);
bool kill(int pID);
int returnpDB(int pID);
private:
bool saveProcess(int pID, int type);
protected:
int pDB[MAX_PROCESS_ID];
};
and what i want to do it's initialize this class from another one and keep a reference.
for example:
class classB
{
public:
classB(){};
virtual ~classB(){ };
private:
protected:
classA ±
};
how can i do this? (if I can!)
thanks!
class classB
{
public:
classB(classA& ref):pm(ref){};
virtual ~classB(){ };
private:
protected:
classA ±
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.