[Webinar] Streamline your web hosting managementRegister Today


BaseClass TObject

Posted on 2008-02-08
Medium Priority
Last Modified: 2010-04-05

Isn't the base class TObject just plain text, how can i get an example of the baseclass TObject?
And I try to find a picture in Delphi Help that displays the tree of all the classes.

Question by:peterkiers
  • 3
  • 2
  • 2
  • +1
LVL 21

Accepted Solution

ziolko earned 800 total points
ID: 20850418
TObject is defined in System.pas
this is D2007 declaration:

  TObject = class
    constructor Create;
    procedure Free;
    class function InitInstance(Instance: Pointer): TObject;
    procedure CleanupInstance;
    function ClassType: TClass;
    class function ClassName: ShortString;
    class function ClassNameIs(const Name: string): Boolean;
    class function ClassParent: TClass;
    class function ClassInfo: Pointer;
    class function InstanceSize: Longint;
    class function InheritsFrom(AClass: TClass): Boolean;
    class function MethodAddress(const Name: ShortString): Pointer;
    class function MethodName(Address: Pointer): ShortString;
    function FieldAddress(const Name: ShortString): Pointer;
    function GetInterface(const IID: TGUID; out Obj): Boolean;
    class function GetInterfaceEntry(const IID: TGUID): PInterfaceEntry;
    class function GetInterfaceTable: PInterfaceTable;
    function SafeCallException(ExceptObject: TObject;
      ExceptAddr: Pointer): HResult; virtual;
    procedure AfterConstruction; virtual;
    procedure BeforeDestruction; virtual;
    procedure Dispatch(var Message); virtual;
    procedure DefaultHandler(var Message); virtual;
    class function NewInstance: TObject; virtual;
    procedure FreeInstance; virtual;
    destructor Destroy; virtual;

>>And I try to find a picture in Delphi Help that displays the tree of all the classes.

I've seen it in some book about Delphi but it's not accessible from IDE however you can go to Menu -> View -> Structure (Shift + Alt + F11) to see tree with classes in current unit

LVL 26

Assisted Solution

by:Russell Libby
Russell Libby earned 800 total points
ID: 20850546
Object tree in PDF format, covers up to Delphi 5




Author Comment

ID: 20850629
I have a little difficulty to find out the diffirence between the term Object and Class? Can you explain it to me?

I think that TObject is a class: a collection of variabels, procedures and functions that belong together. But is not an object!

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

LVL 21

Expert Comment

ID: 20850905
>>I think that TObject is a class

yes, TObject is class but class is not same as object. objects are instances of class

in other words:

  anobject: TObject;
  Panel1: TPanel;

TObject is class, but >>anobject<< is object (of class TObject)
TPanel is class, but Panel1 is object (of class TPanel)

LVL 21

Assisted Solution

developmentguru earned 400 total points
ID: 20850926
A class is like a templace for an object.  Sort of like a cookie cutter is used to create cookies of a spcific shape.  A class defines what an object will be.  When you call TClass.Create you then create an instance of that class which is referred to as an object.  It goes from being a template of an object to actually being a object.  Does that make sense to you?
LVL 21

Expert Comment

ID: 20850953
object is something that you can create and destroy (Panel1 := TPanel.Create(); Panel1.Free).
class is declaration how instances (instances  = objects of class) behave and what properties they have.

I wish I could explain it better but my english sucks:)

LVL 26

Expert Comment

by:Russell Libby
ID: 20850980
Yep, from the help file:

>> A class, or class type, defines a structure consisting of fields, methods, and properties. Instances of a class type are called objects. <<

Class is the definition, and an object is a created instance of that definition


Author Comment

ID: 20851068
Thanks for the info...


Peter Kiers

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
Suggested Courses

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question