Your header file looks great. Note: the SetCode and Correct functions do not REQUIRE you to declare the variable within the class definition, but it doesn't do any harm there either.
Example: "bool SetCode(AnsiString NewCode)" can be put as "bool SetCode(AnsiString)" in the class, as long as you declare that string in the function definition (like in Martee's response).
ILC gave a pretty good cut and dry layout of what your implementation file for the header should look like (that's the .cpp file that does along with the one you gave us).
Your example function def looked like this:
Code:
void BarrierType::SetCode(AnsiString NewCode)
{
Code = NewCode;
if NewCode == '4';
NewCode = false;
else
NewCode = true;
} One thing that I wanted to point out is that in your header file you protoyped the function SetCode with a Return type of bool, and not void.
If indeed you do define it as bool, then you need to return a boolean value to the function call. Like this:
Code:
bool BarrierType::SetCode(AnsiString NewCode)
{
// Necessary code in here, including declaration of a
// variable of type bool to return later
return <variable name here>;
} I'm sure you probably know this, but all functions not of type "void" must return a value.
