Академический Документы
Профессиональный Документы
Культура Документы
Chapter 2
Introduction
If there is a motivation behind objectoriented system development, it is the desire to make the software development easier and more natural by rising the level of abstraction to the point where applications can be implemented in the same terms in which they are described by users.
Introduction
Let us develop an notion of an object through an example. A car is an object ,a real world entity, identifiably separate to with the surroundings. A car has a well-defined set ob attributes in relation to other objects such as color, manufacturer, cost, owner a well defined set of thing you would usually do with it drive, lock, carry passengers, etc.
Introduction
In object orientation we call the attributes ad properties and actions as methods. Properties describe the state of an object. Methods define the behavior.
Objects
The term Object was first formally utilized in Simula language. The term object means a combination of data and logic that represents some real entity. In object-oriented system, everything is an object. Each of us deal with object daily.
Objects
When developing object-oriented applications, two basic questions always arise: What objects does the application need? What functionality should those objects have?
Class Hierarchy
An object-oriented system organizes classes into a subclass-superclass hierarchy. At the top of the class hierarchy are the most general classes and at the bottom are the most specific. The sub class inherits all the properties and methods defined in its superclass.
Class Hierarchy
Inheritance
Inheritance is a property of objectoriented systems that allows objects to be built from other objects. It takes the advantage from the commonality of objects when constructing new classes. Inheritance is the relationship between the classes where one is parent class of another (derived) class.
Inheritance
Parent class is also known as super class or base class. The main advantage of this technique is that we can build on what we already have and more, important, reuse what we already have. Inheritance allows us to share and reuse the behaviors and attributes.
Inheritance
Ford
Mustang
Taurus
Thunderbird
Dynamic Inheritance
Dynamic inheritance allows objects to change and evolve overtime. Since base classes provide properties and attributes for objects, changing the base classes changes the properties and attributes of a class. More specifically, dynamic inheritance refers to the ability to add, delete, or change parents from objects(or classes ) at runtime.
Multiple Inheritance
Some object-oriented systems permit a class to inherit its state(attributes) and behaviors from more than one superclass. This kind of inheritance is referred to as multiple inheritance. Multiple inheritance can pose some difficulties
Multiple Inheritance
Example: Several distinct parents can declare a member within a multiple inheritance hierarchy. One way of achieving benefits of multiple inheritance is to inherit appropriate class and then add an object of another class as an attribute.
Polymorphism
Poly means many and morph means forms. It means objects that can take and assume many forms. Polymorphism means that the same operation may behave differently on different classes. For example, consider how driving an automobile with a manual transmission is different from driving a car with an automatic transmission.
Polymorphism
It is the fundamental concept in OOS. Polymorphism allows us to write generic, reusable code more easily.
Object persistence
Object have lifetime. They are explicitly created and can exist for a period of time that , traditionally, has been the duration of the process in which they were created. From language perspective this characteristics is called persistence.
Meta Classes
Information about classes is called meta class.