![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Product Manuals » Elevate Web Builder 3 Manual » Language Reference » Methods |
interface TVehicle = class protected function GetNumWheels: Integer; virtual; public property NumWheels: Integer read GetNumWheels; end; TTruck = class(TVehicle) protected function GetNumWheels: Integer; override; end; implementation function TVehicle.GetNumWheels: Integer; begin Result := 4; end; function TTruck.GetNumWheels: Integer; begin Result := 10; end;
interface TVehicle = class protected function GetNumWheels: Integer; virtual; abstract; public property NumWheels: Integer read GetNumWheels; end; TTruck = class(TVehicle) protected function GetNumWheels: Integer; override; end; implementation function TTruck.GetNumWheels: Integer; begin Result := 10; end;
interface TCar = class protected function GetAvailableColors: String; virtual; public property AvailableColors: String read GetAvailableColors; end; TJaguar = class(TCar) protected function GetAvailableColors: String; override; end; implementation function TCar.GetAvailableColors: String; begin Result := 'Red, Black, White'; end; function TJaguar.GetAvailableColors: String; begin Result := inherited GetAvailableColors + ', Silver'; end;
TCustomers = class public procedure Delete(ID: Integer); procedure Delete(const Name: String); end;
TCustomers = class public procedure Add(ID: Integer); procedure Add(ID: Integer; const Name: String); procedure Add(const Name: String); end;
TMyClass = class private class FCreateCount: Integer; public constructor Create; override; class function GetCreateCount: Integer; end; implementation constructor TMyClass.Create; begin inherited Create; Inc(FCreateCount); end;
procedure ShowCreateCount; var TempInstance: TMyClass; begin TempInstance:=TMyClass.Create; try ShowMessage(IntToStr(TempInstance.GetCreateCount)); finally TempInstance.Free; end; end;
procedure ShowCreateCount; begin ShowMessage(IntToStr(TMyClass.GetCreateCount)); end;
interface TCustomer = class private FID: Integer; FName: String; public property ID: Integer read FID write FID; property Name: String read FName write FName; end; TCustomers = class private FCustomers: TObjectList; // TObjectList class is declared // in the WebCore unit procedure CreateDemoCustomers(Value: Integer); function GetNumCustomers: Integer; function GetCustomer(ID: Integer): TCustomer; function GetCustomer(const Name: String): TCustomer; public constructor Create; override; constructor Create(NumDemoCustomers: Integer); property NumCustomers: Integer read GetNumCustomers; property Customer[ID: Integer]: TCustomer read GetCustomer; default; property Customer[const Name: String]: TCustomer read GetCustomer; default; end; implementation constructor TCustomers.Create; begin inherited Create; FCustomers:=TObjectList.Create; end; constructor TCustomers.Create(NumDemoCustomers: Integer); begin Create; CreateCustomers(NumDemoCustomers); end; procedure TCustomers.CreateDemoCustomers(Value: Integer); var I: Integer; TempCustomer: TCustomer; begin for I:=0 to Value-1 do begin TempCustomer:=TCustomer.Create; with TempCustomer do begin ID:=I; Name:='Demo Customer #'+IntToStr(I); end; FCustomers.Add(TempCustomer); end; end; function TCustomers.GetNumCustomers: Integer; begin Result:=FCustomers.Count; end; function TCustomers.GetCustomer(ID: Integer): TCustomer; var I: Integer; begin Result:=nil; for I:=0 to FCustomers.Count-1 do begin if (TCustomer(FCustomers[I]).ID=ID) then begin Result:=TCustomer(FCustomers[I]); Break; end; end; end; function TCustomers.GetCustomer(const Name: String): TCustomer; var I: Integer; begin Result:=nil; for I:=0 to FCustomers.Count-1 do begin if SameStr(TCustomer(FCustomers[I]).Name,Name) then begin Result:=TCustomer(FCustomers[I]); Break; end; end; end;
This web page was last updated on Thursday, November 16, 2023 at 10:39 AM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |