Форум по Delphi программированию

Delphi Sources



Вернуться   Форум по Delphi программированию > Все о Delphi > [ "Начинающим" ]
Ник
Пароль
Регистрация <<         Правила форума         >> FAQ Пользователи Календарь Поиск Сообщения за сегодня Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
  #3  
Старый 03.06.2010, 04:42
Kapitoshka438 Kapitoshka438 вне форума
Начинающий
 
Регистрация: 09.11.2009
Сообщения: 145
Репутация: 238
По умолчанию

Можно еще вот так.
Код:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
unit Unit2;
 
interface
 
type
  TPoint = class
  end;
 
  TVector3i = class(TPoint)
    X1, X2, X3: Integer;
  end;
 
  TVector4i = class(TPoint)
    X1, X2, X3, X4: Integer;
  end;
 
  TSingle = class(TPoint)
    X1: Single;
  end;
 
  TPointClass = class of TPoint;
 
  TBaseLocations = class
    FClassIndex: Integer;
    Location : array of Integer;
    Name: array of ^string;
    Value: array of TPoint;
    procedure SetLengthFor(NewLength: Integer);
    destructor Destroy; override;
  end;
 
  TInteger3Locations = class(TBaseLocations)
    constructor Create;
  end;
 
  TInteger4Locations = class(TBaseLocations)
    constructor Create;
  end;
 
  TFloat1fLocations = class(TBaseLocations)
    constructor Create;
  end;
 
var
  PointsClasses: array [1..3] of TPointClass = (TVector4i, TVector3i, TSingle);
 
implementation
 
{ TBaseLocations }
 
destructor TBaseLocations.Destroy;
var
  I: Integer;
begin
  for I := Low(Value) to High(Value) do
    Value[i].Free;
  inherited;
end;
 
procedure TBaseLocations.SetLengthFor(NewLength: Integer);
var
  I: Integer;
begin
  SetLength(Location, NewLength);
  SetLength(Name, NewLength);
  SetLength(Value, NewLength);
  for I := 0 to NewLength - 1 do begin
    Value[i] := PointsClasses[i].Create;
    New(Name[i]);
  end;
end;
 
{ TInteger3Locations }
 
constructor TInteger3Locations.Create;
begin
  FClassIndex := 2;
end;
 
{ TInteger4Locations }
 
constructor TInteger4Locations.Create;
begin
  FClassIndex := 1;
end;
 
{ TFloat1fLocations }
 
constructor TFloat1fLocations.Create;
begin
  FClassIndex := 3;
end;
 
end.
Ответить с цитированием
 


Delphi Sources

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы не можете редактировать сообщения

BB-коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход


Часовой пояс GMT +3, время: 02:52.


 

Сайт

Форум

FAQ

Соглашения

Прочее

 

Copyright © Форум "Delphi Sources" by BrokenByte Software, 2004-2025