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)

    Long live Free Quebec!
    (Vive le Québec Libre!
    Charles De Gaulle (1890–1970)

    There are two kinds of people one can call reasonable: those who serve God with all their heart because they know him, and those who seek him with all their heart because they do not know him.
    —Blaise Pascal (1623–1662)

    Is not prayer also a study of truth,—a sally of the soul into the unfound infinite? No man ever prayed heartily, without learning something. But when a faithful thinker, resolute to detach every object from personal relations, and see it in the light of thought, shall, at the same time, kindle science with the fire of the holiest affections, then will God go forth anew into creation.
    Ralph Waldo Emerson (1803–1882)