PDA

View Full Version : member



mickey
25th July 2006, 12:17
hi, I need 2 members similar:


void ob::Write(QTextStream& xstrm)
void ob::Write(QTextStream& xstrm, QProgressDialog*)

but it contain 100 lines. Do I have to repeat the entire body of member twice? another way? thanks

wysota
25th July 2006, 12:54
You can use the default value and implement only one of the methods:


void ob::Write(QTextStream& xstrm, QProgressDialog *pd=0){
if(pd==0){
// no second parameter, act accordingly
}
}

Michiel
28th July 2006, 20:37
Either that, or you can place the code common to both functions in a third (private) function and call it from both. Personally, I prefer it that way.