In my class: I want to create a public function which has as argument a private member of the class. And be able to call this function from outside of the class.
Something like that:
class MailToTerm
{
public:
MailToTerm();
int getPrivMax(intWithMax priv) {return priv.getMax();} //my public function
void initPrivMax(intWithMax priv) {return priv.initMax();}
void getMutexObjPriv(intWithMax priv) {return priv.GetMutexObj();}
void relMutexObjPriv(intWithMax priv) {return priv.RelMutexObj();}
private:
intWithMax cnter_multi_busy ;
intWithMax cnter_mono_busy ;
intWithMax cnter_light_busy ;
}
int main(){
MailToTerm* pt_MailToTerm = new MailToTerm();
int multi = pt_MailToTerm->getPrivMax(MailToTerm::cnter_multi_busy);
int mono= pt_MailToTerm->getPrivMax(MailToTerm::cnter_mono_busy);
}
It doesn't work because cnter_multi_busy is seen as "private", so I'm not allowed to access it. How should I do?