Skip to main content

Introduction to Object-Oriented Programming

Objects and classes 

  • Encapsulation and information hiding 



  •  Mental exercises 
  •           Classification and exemplification
  •           Aggregation and decomposition
  •           Generalization and specialization


Inheritance 

• Polymorphism and dynamic binding 

Java an example of an object-oriented programming language 

  •         Program example
  •         History of Java
  •         Comparison to C/C+

Comments

Popular posts from this blog

Generalization and Specialization

Generalization creates a concept with a broader scope. Specialization creates a concept with a narrower scope. Reusing the interface!  Inheritance: get the interface from the general class. Objects related by inheritance are all of the same type.

Polymorphism and Dynamic Binding

Polymorphism: One piece of code works with all shape objects. Dynamic binding: How polymorphism is implemented Take previous Shape class hierarchy  remove inheritance  remove general and abstract class Shape 

The Object Concept

An object is an encapsulation of data.  An object has identity (a unique reference)  social security number (cpr), employee number, passport number state, also called characteristics (variables)  hungry, sad, drunk, running, alive  behavior (methods) eat, drink, wave, smile, kiss  An object is an instance of an class   A class is often called an Abstract Data Type (ADT).