Object orientation allows a program to be separated into blocks of related data and the operations which apply to that data. Linking the data and its operations together in this way allows it to be treated as a single entity (an object) and means that the data can only be accessed directly by its associated operations.
A class is a blueprint for an object. Once a class has been defined, any number of objects can be created from that class. When you are defining a class, you need to think about what kind of objects will be created from that class.
A class definition will describe what data it needs to use, known as instance variables, and what it will be able to do, known as methods. Th use of classes in object-oriented programming means that class libraries can be build up, saving project development time.
A procedural language program is built from a number of procedures called from a main procedure. An object-oriented program will have a number of methods linked to the class within which they are defined, in line with the idea of keeping classes and objects self-contained.
A class diagram is used for a quick overview of the system. It describes the structure of a system by showing its:
A class diagram consists of: