Exforsys.com
 
Home Tutorials OOPS
 

Object Oriented Programming Concepts

 

Object Oriented Programming Concepts

Three of the most basic concepts for object oriented programming are Classes, Objects, and Methods. However, there are a few more concepts that you will want to become familiar with. These are Inheritance, Abstraction, Polymorphism, Event, and Encapsulation.



In this article, I will be using the class Cats as an example. Inheritance will allow a sub-group to make a connection with the associates of its parent class. For example, lets say the class Cats decides to create a method called purr() and a property named Colorfur. As the name implies, a property is a specific attribute which is connected to an object.

Every sub-group will be able to inherit the associates, and this means the developer only needs to create the code for them one time. The traits that are inherited by the sub-group can be changed. For example, the Persian cat class may choose to make the Colorfur white for their default color. In contrast, another cat breed may choose a different Colorfur trait. It is also possible for the sub-group to add new associates. If a specific cat Class sub-group wants to set a default eye color, this can be inherited as well. Some object oriented programming languages may also allow a class to inherit traits from multiple ancestors, and this is called multiple inheritance. Some programs may not allow this.

The next concept that you will want to be familiar with is called "abstraction." Abstraction can be defined as the process in which an application will ignore the characteristics of a sub-group and work on a general level when it is needed. As an example, Betsy the cat may be treated as a cat when it is necessary, but she may also be processed as a Felidae, which is a superclass of cat family. Polymorphism is an important concept of object oriented programming that you will want to become familiar. It can be defined as a behavior which is dependent on the class to which it is connected. As an example, if a Cat is sent a command to speak, this may cause it to purr, while a dog will bark, or a lion may roar.

Anyone who is interested in object oriented programming will also need to know encapsulation. Encapsulation will allow a class to hide information from objects that may use the code. For example, the Cat class will have a purr() method. A code will be written which will explain how the cat purrs. Despite this, it is not necessary for Betsy the cat to know how she purrs. Encapsulation makes it easier for the developer to change the code without having to change the code for Betsy. When the structure of class is hidden, it is harder for it to be used in the wrong way.

Encapsulation will basically state which class is allowed to use the members of a certain object. This concept makes it easier for programmers to deal with or avoid errors when developing a program. The members within OOP can be categorized as being protected, public, or private. The last concept that you will want to become familiar with is called an event. 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. Another term that advanced programmers may run into is called multiple inheritance. It is a situation where a class is able to inherit traits from a number of different superclasses.

A multiple inheritance can create a number of perplexing situations. Because of this, there is debate in the programming community about whether it is beneficial or risky. One example of a program which deals with multiple inheritances is Java.



It will permit a class to have interfaces which come from multiple parents, but it can only inherit methods from a single parent. Other programming languages which use this approach are C# and Visual Basic. It is important to understand the various concepts which are connected to object oriented programming. Once you understand the concepts, you will be equipped to begin learning specific OOP languages. There are a number of popular object oriented programming languages that are being used, and one of the most popular is Java.



Read Next: Object Oriented Programming As a Paradigm



 

 

Comments


leticia said:

  nice information given pls keep it up .thanks very much,
April 24, 2007, 2:12 pm

Deepan Mukherjee said:

  I hope that many people will be able to understand clearly as I understand. Thanks, Keep it up and try to add more information about OPP's.
May 7, 2007, 5:43 am

Ramya Karthik said:

  the content given is too useful to all the beginers. but what my suggestion is "Add sub titles for each topic" it will be more useful and more clear..
May 28, 2007, 4:31 am

Mothiram said:

  Nice, Just learning the concep of OOPS and et to know the programming concepts as a Begginer in programming
June 5, 2007, 11:53 pm

Parasmani said:

  Nice, easy to understand and yes I also agree with Ramya - it should have sub-titles.
July 18, 2007, 9:54 pm

VBonthap said:

  Please include basic structure of the programmig which can make more sense.
August 17, 2007, 6:32 pm

Anitha Manesh said:

  The concepts are clearly defined .It's good for beginners and also brush up for the intermediates.
:)
October 16, 2007, 9:32 am

Bosco Lawerence said:

  Nice one,should add some more content
November 9, 2007, 3:06 am

Aayushi Dhawan said:

  Gud work, Really vry easy to brushup all the concepts in less time....:)
November 27, 2007, 12:50 am

sarvarayudu said:

  Its a wonderful tutorial. Everyone will understand it.

Thankyou thankyou verymuch.
December 26, 2007, 1:34 am

saravanan chidambaram said:

  NIce one for beginners. Need more examples
December 27, 2007, 8:57 am

Kmr said:

  Thanks this article is very important for me. Because this is in my course. Thank you very much.
January 11, 2008, 8:31 am

punda said:

  it's make me comfort in c
February 10, 2008, 11:52 pm

Mradul Gupta said:

  Nice one for all beginners and good one for brush up for others
May 26, 2008, 3:09 am

Vineet Gandhi said:

  Thanks for this. Good.
July 21, 2008, 4:46 am

madhu said:

  very Ncce Tutorials ,if provied Examples for those topics it is much butter
November 19, 2008, 8:18 am

Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links

 

Subscribe via RSS


Get Daily Updates via Subscribe to Exforsys Free Training via email


Get Latest Free Training Updates delivered directly to your Inbox...

Enter your email address:


 

Subscribe to Exforsys Free Training via RSS
 

 
Partners -  Privacy and Legal Policy -  Site News -  Contact   Sitemap  

Copyright © 2000 - 2010 exforsys.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape