Monday, April 12, 2010

OOPS-Building blocks-2

Continuing from the last post, we will look at what it means with
  • abstraction
  • polymorphism
  • encapsulation
  • event



Abstraction is the process of ignoring the sub-class properties and using the ones from super class when required. For Example, our own CharlizeTheron, a Female can at times be treated as HumanBeing.

Polymorphism as the name itself suggests is the ability to take many shapes. For example, if we have another super class Animals, with sub classes Cats, Dogs, Monkey etc. the  command to speak would mean different to everyone.

Encapsulation is the process of hiding the necessary information from the objects. For example an object of the Dogs class may be asked to bark but it may not need to know how to bark. All it needs is to use the method that explains how to bark. This concept actually uses access specifiers "private, public and protected" to state which property can be accessed in what manner.

An event can simply be defined as anything that happens to an object. Generally, an event is something that will cause the object to react with a method.

We would deal with inheritance and classes in more detail in the next few posts. stay tuned!

No comments: