As mentioned earlier, classes are entities that can contain both data and code. Objects are created instances of those classes. Delphi classes provide you with all the power of object-oriented programming in offering full support of inheritance, encapsulation, and polymorphism.
Of course, before using an object, you must have defined it using the class keyword. As described earlier in this chapter, classes are declared in the type section of a unit or program:
type TFooObject = class;
In addition to a class declaration, you usually also will have a variable of that class type, or instance, declared in the var section:
var FooObject: TFooObject;
You create an instance of an object in Delphi by ...