【发布时间】:2013-06-09 03:00:38
【问题描述】:
在下面的 sn-p 中,我有两个具有完全相同的过程名称的类。这些过程中的代码大不相同。是否可以合并这些类以便于维护和未来的增强,或者我是否会以可接受的方式解决这个问题?
type
TMFRCore = class
private
FGridMain: TNextGrid;
FGridSummary: TNextGrid;
public
constructor Create(Grid: TNextGrid; SummaryGrid: TNextGrid);
destructor Destroy; override;
procedure SetRowColour(Grid: TNextGrid; Row: Integer; Color: TColor; Start: Integer = 0);
procedure OnSummaryDblClick(Sender: TObject);
function GetSectionId(Section: String): Integer;
property GridMain: TNextGrid read FGridMain write FGridMain;
property GridSummary: TNextGrid read FGridSummary write FGridSummary;
end;
type
TMFRDates = class(TMFRCore)
public
procedure UpdateSummary;
procedure UpdateMain(const sAircraft: string);
end;
type
TMFRHours = class(TMFRCore)
public
procedure UpdateSummary;
procedure UpdateMain(const sAircraft: string);
end;
我如下初始化这些类;
procedure TfrmMain.FormCreate(Sender: TObject);
begin
MFRHours := TMFRHours.Create(gridHours, gridHoursSummary);
MFRDates := TMFRDates.Create(gridDates, gridDatesSummary);
end;
【问题讨论】:
标签: delphi delphi-xe4