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)

    In some unused lagoon, some nameless bay,
    On sluggish, lonesome waters, anchor’d near the shore,
    An old, dismasted, gray and batter’d ship, disabled, done,
    After free voyages to all the seas of earth, haul’d up at last and
    hawser’d tight,
    Lies rusting, mouldering.
    Walt Whitman (1819–1892)

    The conduct of God who disposes all things kindly, is to put religion into the mind by reason, and into the heart by grace. But to attempt to put it into the mind and heart by force and threats is not to put religion there, but terror.
    —Blaise Pascal (1623–1662)

    The sum and substance of female education in America, as in England, is training women to consider marriage as the sole object in life, and to pretend that they do not think so.
    Harriet Martineau (1802–1876)