Skip to main content

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).


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