I want to have 3 different functions all called "AddField" where each function has different parameters. Based on the parameters, the language will know which function to call. Delphi has this concept if you mark the function as "overload".
void addField(int tableID, fieldID) {
addfield(tableID, fieldID, 0, 0)
}
void addField(int tableID, fieldID, groupID) {
addfield(tableID, fieldID, groupID, 0)
}
void addField(int tableID, fieldID, groupID, size) {
item = FieldItem();
item.tableID = tableID;
item.fieldID = fieldID;
item.groupID = groupID;
item.size = size;
fieldlist.add(item);
}
and they can be used this way...
void addClientFields(){
addfield(tblIDClient, fldIDName, grpContact, 30);
addfield(tblIDClient, fldIDActive);
addfield(tblIDClient, fldIDDate, grpSettings);
}
Dart doesn't have Method overloading
. You can make method with different name or use optional paramater with default value.
void addField(int tableID, fieldID, [int groupID = 0, int size = 0]) {
item = FieldItem();
item.tableID = tableID;
item.fieldID = fieldID;
item.groupID = groupID;
item.size = size;
fieldlist.add(item);
}