Object Pascal - Sample "Hello World" Programs - Delphi and Free Pascal's Object Pascal

Delphi and Free Pascal's Object Pascal

program ObjectPascalExample; type THelloWorld = class procedure Put; end; procedure THelloWorld.Put; begin Writeln('Hello, World!'); end; var HelloWorld: THelloWorld; { this is an implicit pointer } begin HelloWorld := THelloWorld.Create; { constructor returns a pointer to an object of type THelloWorld } HelloWorld.Put; HelloWorld.Free; { this line deallocates the THelloWorld object pointed to by HelloWorld } end.

Note that the object construct is still available in Delphi and Free Pascal (Delphi-compatible mode).

Read more about this topic:  Object Pascal, Sample "Hello World" Programs

Famous quotes containing the words delphi, free, pascal and/or object:

    At Delphi I prayed
    to Apollo
    that he maintain in me
    the flame of the poem
    and I drank of the brackish
    spring there....
    Denise Levertov (b. 1923)

    Can a free people restrain crime without sacrificing fundamental liberties and a heritage of compassion?... Let us show that we can temper together those opposite elements of liberty and restraint into one consistent whole. Let us set an example for the world of a law-abiding America glorying in its freedom as well as its respect for law.
    Gerald R. Ford (b. 1913)

    Man is, then, only disguise, falsehood, hypocrisy—both in himself and in regard to others. He does not wish any one to tell him the truth; he avoids telling it to others; and all these dispositions, so removed from justice and reason, have a natural root in his heart.
    —Blaise Pascal (1623–1662)

    I began my editorial career with the presidency of Mr. Adams, and my principal object was to render his administration all the assistance in my power. I flattered myself with the hope of accompanying him through [his] voyage, and of partaking in a trifling degree, of the glory of the enterprise; but he suddenly tacked about, and I could follow him no longer. I therefore waited for the first opportunity to haul down my sails.
    William Cobbett (1762–1835)