430 likes | 579 Views
Objected Oriented Design (OOD) and Objected Oriented Programming (OOP)The fundamentals of OOD are:1. Encapsulation?combine data and operations on data in a single unit. 2. Inheritance?create new objects from existing objects.3. Polymorphism?the ability to use the same expression to denote differ
E N D
1. CSci 152: Programming IIFall 2004 Composition
2. Objected Oriented Design (OOD) and Objected Oriented Programming (OOP)
The fundamentals of OOD are:
1. Encapsulation—combine data and operations on data in a single unit.
2. Inheritance—create new objects from existing objects.
3. Polymorphism—the ability to use the same expression to denote different operations.
3. In OOD an object is a fundamental entity, while in structured programming a function is a fundamental entity.
In OOD we debug objects, while in structured programming we debug functions. In structured programming a program is a collection of interacting functions, while in OOD a program is a collection of interacting objects.
OOD encourages code reuse.
In structured programming the programmer is action oriented, while in OOD the programmer is object oriented.
The object-oriented programming (OOP) implements OOD.
C++ supports OOP through the use of classes.
A polymorphic function or operator has many forms.
In C++ a function name and operators can be overloaded.
Templates provide parametric polymorphism.
C++ provides virtual functions as a means to implement polymorphism in an inheritance hierarchy.
4. Objects are created when class variables are declared. Objects interact with each other via function call. Every object has an internal state and external state. The private members form the internal state and the public members form the external state. Only the object can manipulate its internal state.