Friday, November 27, 2009

operator<< syntax

//IO_Form& IO_Form::operator<<(IO_Field* f){
// return IO_Form::add(f,true,false);
//}

hey can anyone help me with this?

1 comment:

  1. first: you are returning add(f, true, false). doesn't add return an int?
    the reason operator<< returns IO_FORM& is to make the following series of add possible:
    IO_FROM& F;
    F<<new IO_Label(....)<<new IO_CheckList(.....)<<new IO_...; so each operator<< returns the IO_Form& for next one to use.
    So; in your function instead of returning add, just call add and then return "*this"
    ...
    add(f, true, false);
    return *this;
    }

    ReplyDelete