Chapter 2: The Delphi Programming Language

Chapter 2: The Delphi Programming Language


The Delphi development environment is based on an object-oriented extension of the Pascal programming language known as Object Pascal. Recently, Borland stated its intention to refer to the language as "the Delphi language," probably because the company wants to be able to say that Kylix uses the Delphi language and because Borland will provide the Delphi language on the Microsoft .NET platform. Due to years of habit, I'll use the two names interchangeably.

Most modern programming languages support object-oriented programming (OOP). OOP languages are based on three fundamental concepts: encapsulation (usually implemented with classes), inheritance, and polymorphism (or late binding). Although you can write Delphi code without understanding the core features of its language, you won't be able to master this environment until you fully understand the programming language.


Due to space constraints and to the fact that the language hasn't changed much in recent years, in this chapter you'll find only a very fast-paced introduction to the language. You can read the more detailed description found in past editions of the book in the material available on my website (see Appendix C, "Free Companion Books on Delphi," for details). This material also includes Essential Pascal, a complete introduction to the standard Pascal language.

The following topics are covered in this chapter:

  • Classes and objects

  • Encapsulation: private and public

  • Using properties

  • Constructors

  • Objects and memory

  • Inheritance

  • Virtual methods and polymorphism

  • Type-safe down-casting (run-time type information)

  • Interfaces

  • Working with exceptions

  • Class references

Part I: Foundations