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)

    The modern picture of The Artist began to form: The poor, but free spirit, plebeian but aspiring only to be classless, to cut himself forever free from the bonds of the greedy bourgeoisie, to be whatever the fat burghers feared most, to cross the line wherever they drew it, to look at the world in a way they couldn’t see, to be high, live low, stay young forever—in short, to be the bohemian.
    Tom Wolfe (b. 1931)

    The strength of a man’s virtue must not be measured by his efforts, but by his ordinary life.
    —Blaise Pascal (1623–1662)

    The division between the useful arts and the fine arts must not be understood in too absolute a manner. In the humblest work of the craftsmen, if art is there, there is a concern for beauty, through a kind of indirect repercussion that the requirements of the creativity of the spirit exercise upon the production of an object to serve human needs.
    Jacques Maritain (1882–1973)