K
kenmen
Unregistered / Unconfirmed
GUEST, unregistred user!
有一个新类:
type
TCountButton = class (TButton)
constructor Create (AOwner: TComponent)
override;
destructor Destroy
override;
class function GetTotal: Integer;
end;
constructor TCountButton.Create (AOwner: TComponent);
begin
1)inherited;
Inc (TotBtns);
end;
destructor TCountButton.Destroy;
begin
Dec (TotBtns);
2)inherited Destroy;
end;
1)和2)中的inherited有啥用途?为啥2)之后有Destroy,而1)后是空的,没Create?
还有想问问class function GetTotal: Integer;这个类方法与普通类的方法有啥不同,
有啥用?在此先谢谢了!
type
TCountButton = class (TButton)
constructor Create (AOwner: TComponent)
override;
destructor Destroy
override;
class function GetTotal: Integer;
end;
constructor TCountButton.Create (AOwner: TComponent);
begin
1)inherited;
Inc (TotBtns);
end;
destructor TCountButton.Destroy;
begin
Dec (TotBtns);
2)inherited Destroy;
end;
1)和2)中的inherited有啥用途?为啥2)之后有Destroy,而1)后是空的,没Create?
还有想问问class function GetTotal: Integer;这个类方法与普通类的方法有啥不同,
有啥用?在此先谢谢了!