View Single Post
Old March 31st, 2003, 11:48 PM     #3 (permalink)
Martee
Member
 
Join Date: Feb 2002
Posts: 161
Code:
void BarrierType::SetCode(AnsiString NewCode)
{
    Code = NewCode;
    if NewCode == '4';
        NewCode = false;
    else
        NewCode = true;
}
Your if statement is incorrect. You need to use parentheses ( ) , and you need to remove the semicolon at the end. Also, the NewCode == '4' comparison is most likely wrong, although it's impossible to tell for sure without seing the definition of the AnsiString class. Your code should probably look something like this:
Code:
void BarrierType::SetCode(AnsiString NewCode)
{
    Code = NewCode;
    if(NewCode == "4")
        NewCode = false;
    else
        NewCode = true;
}
Hopefully that should give you some hints as to how to write the functions.
Martee is offline   Reply With Quote