alt
Advertisement
Sponsored links
Online Training
Career Series
Exforsys
Exforsys arrow Tutorials arrow OOPS arrow Object Oriented Programming Concepts
Site Search


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.


Trackback(0)
Comments (13)add comment

leticia said:

  nice information given pls keep it up .thanks very much,
April 24, 2007

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 07, 2007

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

Mothiram said:

  Nice, Just learning the concep of OOPS and et to know the programming concepts as a Begginer in programming
June 05, 2007

Parasmani said:

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

VBonthap said:

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

Anitha Manesh said:

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

Bosco Lawerence said:

  Nice one,should add some more content
November 09, 2007

Aayushi Dhawan said:

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

sarvarayudu said:

  Its a wonderful tutorial. Everyone will understand it.

Thankyou thankyou verymuch.
December 26, 2007

saravanan chidambaram said:

  NIce one for beginners. Need more examples
December 27, 2007

Kmr said:

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

punda said:

  it's make me comfort in c
February 10, 2008

Write comment

busy
 
< Prev   Next >
Exforsys Offers
© 2008 Exforsys.com
Joomla! is Free Software released under the GNU/GPL License.
Page copy protected against web site content infringement by Copyscape