Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2006.03.26;
Скачать: CL | DM;

Вниз

Propose small change to _Tobj to the Dacha man ;)   Найти похожие ветки 

 
Thaddy   (2005-08-05 01:47) [0]

This is an architectural matter.

What are your thoughts about this possible change to _Tobj (The basic object for Tobj and therefore Tcontrol):
I propose to make the *first* field an untyped pointer, so that you can assign other objects or data to it, just like CustomObj and CustomData.
The advantage is, that you can typecast a full Tobj descendant to the type that holds the pointer:

type
 PPMyObject = ^PMyObject;
 PMyObject = ^TMyObject;
 TMyObject = object(Tobj)
 ....
 end;

Now if the *first* field in _Tobj were a pointer, we could assign a structure to it, say, PWaveFormatEx and we could typecast the whole object as PPWaveFormatEx. Actually simulating interfaces and /or "friend" in C++
You can already do this with simple objects, but you loose the power of the destructor/free. (Add2Autofree, etc)
Right Now the first field is FRefCount. Ithink my proposal would not break the code, only Frefcount and fTag need to be switched?
Or am I missing something?


 
Thaddy   (2005-08-05 02:01) [1]

And the typecast would be:


var

 WaveFormat:TWaveFormatEx; // or any other record or object

 MyObject:PMyobject;
begin
 MyObject:=NewMyObject;
 MyObject.Tag:=Cardinal(@WaveFormat);// Assumes the above!
 PPWaveFormatEx(MyObject).nSamplesPerSec:=44100;
end;



Страницы: 1 вся ветка

Текущий архив: 2006.03.26;
Скачать: CL | DM;

Наверх




Память: 0.46 MB
Время: 0.041 c
15-1141390499
NightLord
2006-03-03 15:54
2006.03.26
Глюк или так и должно быть


15-1141138547
Nick Denry
2006-02-28 17:55
2006.03.26
"СЕТЕЦЕНТРИЧНАЯ ВОЙНА": ИСТОКИ И ТЕХНИЧЕСКИЕ АСПЕКТЫ


11-1122728443
jumpingjack
2005-07-30 17:00
2006.03.26
Не компилируется KOL проект.


2-1141906227
jeka_t
2006-03-09 15:10
2006.03.26
Может ли DBGrid иметь разное значение RowsHeigth для каждой Ячейк


2-1142168978
Golik
2006-03-12 16:09
2006.03.26
Как указать путь к БД ????