I have an abstract class:
type
TInterfaceMethod = class abstract
public
destructor Destroy; virtual; abstract;
function GetBasePlan: Word; virtual; abstract;
procedure CountBasePlan; virtual; abstract;
procedure Calculate; virtual; abstract;
procedure PrepareForWork; virtual; abstract;
end;
and a derived class:
type
TFogelMethod = class(TInterfaceMethod)
private
matrix: TFogelMatrix;
BasePlan: Word;
public
constructor Create(var matr: TFogelMatrix);
procedure Calculate;
function GetBasePlan: Word;
procedure CountBasePlan;
procedure PrepareForWork;
destructor Destroy;
end;
The question is, can I place the implementation of GetBasePlan and CountBasePlan methods into base class, make them only virtual - not abstract as now - and also place member BasePlan there? So, can I do this:
type
TInterfaceMethod = class abstract
private
BasePlan: Word;
public
destructor Destroy; virtual; abstract;
function GetBasePlan: Word; virtual;
procedure CountBasePlan; virtual;
procedure Calculate; virtual; abstract;
procedure PrepareForWork; virtual; abstract;
end;
In case I can do it, will it be good from the point of view of object-oriented design, and how can I exactly access this member from derived classes?