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)

    Russian women all have something free and large about them.
    Thomas Mann (1875–1955)

    The self is hateful.
    —Blaise Pascal (1623–1662)

    Thy hatred for this misery befallen;
    On me already lost, me than thyself
    More miserable. Both have sinned, but thou
    Against God only; I against God and thee,
    And to the place of judgment will return,
    There with my cries importune Heaven, that all
    The sentence, from thy head removed, may light
    On me, sole cause to thee of all this woe,
    Me, me only, just object of his ire.”
    John Milton (1608–1674)