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)

    “There the wicked cease from troubling, and there the weary are at rest. There the prisoners are at ease together; they do not hear the voice of the taskmaster. The small and the great are there, and the slaves are free from their masters.”
    —Bible: Hebrew, Job 3:17-19.

    “The consciousness of the falsity of present pleasures, and the ignorance of the vanity of absent pleasures, cause inconstancy.”
    —Blaise Pascal (1623–1662)

    “Let’s call something a rigid designator if in every possible world it designates the same object, a non-rigid or accidental designator if that is not the case. Of course we don’t require that the objects exist in all possible worlds.... When we think of a property as essential to an object we usually mean that it is true of that object in any case where it would have existed. A rigid designator of a necessary existent can be called strongly rigid.”
    —Saul Kripke (b. 1940)