Recent

Author Topic: which to use "object vs class"? [SOLVED]  (Read 4768 times)

pascal111

  • Sr. Member
  • ****
  • Posts: 423
  • Un trabajo en equipo para programas serias.
Re: which to use "object vs class"? [SOLVED]
« Reply #15 on: May 08, 2021, 11:36:43 pm »
obscure ?

 I don't think so..

 Methods are of object type which have a background variable (self) that points to the instance of the body for any fields, etc.

 Using OBJECT or using Classes, they both work the same way. Difference is that Classes are dynamic only and must always be created to access any member fields excluding Class types. OBJECTS are not bound to this, they can live on the heap or stack and the instance body exist for them or they can be dynamically created, its your choice.

 AS for what you were referring to, that is a declared variable (TMethod) if memory serves, and its just a pointer to the a type METHOD. and that can be assigned for events or runtime variations functions to a single method pointer..

 I am sure a 100+ people will come here and twist everything I just said because they can.

That's fine. This is my final comment on this subject anyways..

have a good day and may the bugs be with you.

 

ربّما كان نعت الكلام بالغموض مِزاحاً أو لتهوين الوقت والنقاشات الجادّة ولا أرى سوءاً فيما تفضّلت وقُلت.

التوضيح الذي قدمته الآن يحتوي على معلومات مُفيدة وأعتقد أنّ المقصود بالديناميكيّة في نسخة الـ object هو عن طريق إستخدام المؤشرات للإعلان عن عينات منها بدلاً من مُتغيرات مُعتادة ساكنة تظل تشغل الذاكرة طيلة الـ run-time.

google translate:

"Perhaps the word was called ambiguous as a joke or to belittle the time and serious discussions, and I do not see anything wrong with what I you said and preferred "exerted with".

The illustration I "you" presented now contains useful information and I think what is meant by dynamic in the object version is by using pointers to announce "declare" their samples "instances" instead of regular static variables that keep running the memory throughout the run-time."
La chose par la chose est rappelé.

dseligo

  • Hero Member
  • *****
  • Posts: 1219
Re: which to use "object vs class"?
« Reply #16 on: May 10, 2021, 04:36:56 pm »
As a beginner, if you are writing code for the Turbo/Free Vision framework, or work on other old TP codebases, use object.

Or if he works with AVR target (and possibly other embedded targets without OS to provide memory allocation) then he has to use (static) object.

Quote from: marcov
In all other cases use (delphi styled) classes.

I agree.

 

TinyPortal © 2005-2018