Defining New Classes

From RAD Studio
Jump to: navigation, search

Go Up to Object-oriented programming for component writers Index

The difference between component writers and application developers is that component writers create new classes while application developers manipulate instances of classes.

A class is essentially a type. As a programmer, you are always working with types and instances, even if you do not use that terminology. For example, you create variables of a type, such as Integer. Classes are usually more complex than simple data types, but they work the same way: By assigning different values to instances of the same type, you can perform different tasks.

For example, it is quite common to create a form containing two buttons, one labeled OK and one labeled Cancel. Each is an instance of the class TButton, but by assigning different values to their Caption properties and different handlers to their OnClick events, you make the two instances behave differently.

See Also