1 {* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * See LICENSE.txt included in this distribution for the specific 9 * language governing permissions and limitations under the License. 10 * 11 * When distributing Covered Code, include this CDDL HEADER in each 12 * file and include the License file at LICENSE.txt. 13 * If applicable, add the following below this CDDL HEADER, with the 14 * fields enclosed by brackets "[]" replaced with your own identifying 15 * information: Portions Copyright [yyyy] [name of copyright owner] 16 * 17 * CDDL HEADER END 18 *} 19 20 // Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 21 22 unit Sample; 23 uses 24 User; 25 26 interface 27 type 28 TSample = class 29 private 30 FId : integer; 31 FDescription : String; 32 FUserId: integer; GetId()33 function GetId : integer; 34 procedure SetId(const aValue : integer); 35 public GetClassName()36 class function GetClassName: string; GetIdAndDescriptionString()37 function GetIdAndDescriptionString: string; virtual; GetUser()38 function GetUser: TUser; 39 published 40 property Id: integer read GetId write SetId; 41 property Description: string read FDescription write FDescription; 42 end; 43 44 implementation 45 uses 46 Logging; 47 GetIdnull48function TSample.GetId: integer; 49 begin 50 Result := FId; 51 end; 52 53 procedure TSample.SetId(const aValue: integer); 54 begin 55 FId := aValue; 56 end; 57 TSample.GetClassName()58class function TSample.GetClassName: string; 59 begin 60 Result := 'TSample'; 61 end; 62 GetUsernull63function TSample.GetUser: TUser; 64 begin 65 Result := TUser.Create(FUserId); 66 end; 67 68 end. 69