Forum > General

OOP structures in fpc and Lazarus

<< < (9/14) > >>

ArtLogi:

--- Quote from: VTwin on November 11, 2021, 09:58:48 pm ---As has been pointed out, objects are basically deprecated. Some folks still use them, but if I was learning I would pass over them.

--- End quote ---
As a beginner comment. If 'Objects' are depricated, why is that most LCL more complex data structures (what ever they are called) begin with T and are inherited from TObject? How I can stop using those deprecated objects?  :o

MarkMLl:

--- Quote from: ArtLogi on November 30, 2021, 09:41:13 am ---
--- Quote from: VTwin on November 11, 2021, 09:58:48 pm ---As has been pointed out, objects are basically deprecated. Some folks still use them, but if I was learning I would pass over them.

--- End quote ---
As a beginner comment. If 'Objects' are depricated, why is that most LCL more complex data structures (what ever they are called) begin with T and are inherited from TObject? How I can stop using those deprecated objects?  :o

--- End quote ---

Have you read the document that this thread is discussing? Have you read the FPC etc. documentation?

Despite its name TObject isn't an object (in the sense of the "objects" introduced by Turbo Pascal and later documented).

It's the ultimate superclass of anything declared as a class, where a class can be instantiated into something which is commonly called "an object".

The terminology is unfortunate. Get used to it.

MarkMLl

howardpc:

--- Quote from: ArtLogi on November 30, 2021, 09:41:13 am ---
--- Quote from: VTwin on November 11, 2021, 09:58:48 pm ---As has been pointed out, objects are basically deprecated. Some folks still use them, but if I was learning I would pass over them.

--- End quote ---
As a beginner comment. If 'Objects' are depricated, why is that most LCL more complex data structures (what ever they are called) begin with T and are inherited from TObject? How I can stop using those deprecated objects?  :o

--- End quote ---
There is major confusion here, partly owing to the inherited and confusing use of the term "object" which can and does mean several things depending on context.

TP objects:
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---TTurboPascalObject = object...end;are not deprecated in the FP compiler, only in the Delphi compiler.

Classes:
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---TpostTurboPascalClass = class(TObject)...end;confusingly all descend from "TObject" but this is not a TurboPascal object, but a more complex and more capable construct. The naming was defined by Borland, not by FPC which uses it only to be compatible. However it is a source of confusion for newcomers.

jollytall:

--- Quote from: ArtLogi on November 30, 2021, 09:41:13 am ---As a beginner comment. If 'Objects' are depricated, why is that most LCL more complex data structures (what ever they are called) begin with T and are inherited from TObject? How I can stop using those deprecated objects?  :o

--- End quote ---
Please check the document I wrote. This was actually one of the first pieces of confusion I had years ago, (followed by many others,) that caused me to start writing it.

ArtLogi:
Thank you jollytall, I did read your article first public version, it was really nice read up for an amateur like me.

For the angry answer, yes I did actually verify the class vs. object in TObject declaration, but that would not have been any help to not to post beginners first thoughts.

PS. Isn't type SET also a primitive object datatype, kind of list-object as lack of better description.  :-\

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version