The CTDP Object Oriented Basics Guide Version 0.6.0, January 21, 2001
Object Oriented Basics
What is an Object?
If you are familiar with programming, you know that programming on a very basic level requires:
When writing code, the code is put into what is called procedures or functions. The classic difference between a procedure and a function is that a function returns a value when a procedure does not, however the terms function and procedure are sometimes used interchangeably.
In the real world, an object includes such things as:
You get the idea. In the computer world, objects are simulated using code and data. The data stores the current and permanent states of the object, and the code makes the object perform its functions (also known as behavior). For example in the case of a car permanent object data would include:
There are many more. The current object state describes characteristics of the object that would change with time such as:
To make an object perform functions the following types of functions may be required:
As you can see an object requires the above items and more to make it what it is. Therefore objects in the programming world consist of:
Classes are used to implement objects. Classes are not objects themselves, but are used to create objects. An excellent comparison of classes and objects is to compare a class to a cookie cutter and the object is a cookie. Classes are templates for objects.