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 improved American highway system ... isolated the American-in-transit. On his speedway ... he had no contact with the towns which he by-passed. If he stopped for food or gas, he was served no local fare or local fuel, but had one of Howard Johnson’s nationally branded ice cream flavors, and so many gallons of Exxon. This vast ocean of superhighways was nearly as free of culture as the sea traversed by the Mayflower Pilgrims.
    Daniel J. Boorstin (b. 1914)

    It is the heart which perceives God and not the reason. That is what faith is: God perceived by the heart, not by the reason.
    —Blaise Pascal (1623–1662)

    Life at its noblest leaves mere happiness far behind; and indeed cannnot endure it.... Happiness is not the object of life: life has no object: it is an end in itself; and courage consists in the readiness to sacrifice happiness for an intenser quality of life.
    George Bernard Shaw (1856–1950)